lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20221117151141.20cfc362@xps-13>
Date:   Thu, 17 Nov 2022 15:11:41 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Denis Arefev <arefev@...mel.ru>
Cc:     Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        lvc-project@...uxtesting.org, trufanov@...mel.ru, vfh@...mel.ru
Subject: Re: [PATCH] mtd: lpddr: Added literal suffix

Hi Denis,

arefev@...mel.ru wrote on Thu, 17 Nov 2022 15:36:25 +0300:

> The value of an arithmetic expression
> 1 << lpddr->qinfo->DevSizeShift is subject to overflow
> due to a failure to cast operands to a larger data
> type before perfoming arithmetic
> 
> Signed-off-by: Denis Arefev <arefev@...mel.ru>
> ---
>  drivers/mtd/lpddr/lpddr_cmds.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/lpddr/lpddr_cmds.c b/drivers/mtd/lpddr/lpddr_cmds.c
> index ee063baed136..360b2af8340b 100644
> --- a/drivers/mtd/lpddr/lpddr_cmds.c
> +++ b/drivers/mtd/lpddr/lpddr_cmds.c
> @@ -61,7 +61,7 @@ struct mtd_info *lpddr_cmdset(struct map_info *map)
>  		mtd->_point = lpddr_point;
>  		mtd->_unpoint = lpddr_unpoint;
>  	}
> -	mtd->size = 1 << lpddr->qinfo->DevSizeShift;
> +	mtd->size = 1UL << lpddr->qinfo->DevSizeShift;

Are you sure it should not be 1ULL instead? otherwise I don't see how
the overflow can happen?

>  	mtd->erasesize = 1 << lpddr->qinfo->UniformBlockSizeShift;
>  	mtd->writesize = 1 << lpddr->qinfo->BufSizeShift;
>  


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ