[lvc-project] [PATCH v3] usb: storage: sddr55: fix sloppy typing in sddr55_{read|write}_data()

Sergey Shtylyov s.shtylyov at omp.ru
Sun Jan 21 11:04:01 MSK 2024


On 1/20/24 11:15 PM, Sergey Shtylyov wrote:

   Oops, I forgot:

From: Karina Yankevich <k.yankevich at omp.ru>

   Ignore this version, I'll repost...

> In sddr55_{read|write}_data(), the address variables are needlessly typed
> as *unsigned long* -- which is 32-bit type on the 32-bit arches and 64-bit
> type on the 64-bit arches; those variables' value should fit into just 3
> command bytes and consists of 10-bit block # (or at least the max block #
> seems to be 1023) and 4-/5-bit page # within a block, so 32-bit *unsigned*
> *int* type should be more than enough...
> 
> Found by Linux Verification Center (linuxtesting.org) with the Svace static
> analysis tool.
> 
> Signed-off-by: Karina Yankevich <k.yankevich at omp.ru>
> Signed-off-by: Sergey Shtylyov <s.shtylyov at omp.ru>

[...]

MBR, Sergey



More information about the lvc-project mailing list