[PATCH] mtd: lpddr_cmds: fix signed shifts in lpddr_cmds

Miquel Raynal miquel.raynal at bootlin.com
Sat Nov 29 04:51:24 PST 2025


On Fri, 21 Nov 2025 14:54:46 +0300, Ivan Stepchenko wrote:
> There are several places where a value of type 'int' is shifted by
> lpddr->chipshift. lpddr->chipshift is derived from QINFO geometry and
> might reach 31 when QINFO reports a 2 GiB size - the maximum supported by
> LPDDR(1) compliant chips. This may cause unexpected sign-extensions when
> casting the integer value to the type of 'unsigned long'.
> 
> Use '1UL << lpddr->chipshift' and cast 'j' to unsigned long before
> shifting so the computation is performed at the destination width.
> 
> [...]

Applied to mtd/next, thanks!

[1/1] mtd: lpddr_cmds: fix signed shifts in lpddr_cmds
      commit: c909fec69f84b39e63876c69b9df2c178c6b76ba

Patche(s) should be available on mtd/linux.git and will be
part of the next PR (provided that no robot complains by then).

Kind regards,
Miquèl




More information about the linux-mtd mailing list