[PATCH V2 03/12] nvmet: use consistent type with id->nlbaf

Chaitanya Kulkarni Chaitanya.Kulkarni at wdc.com
Tue Sep 1 17:17:45 EDT 2020


On 9/1/20 08:56, Keith Busch wrote:
> On Mon, Aug 31, 2020 at 03:26:58PM -0700, Chaitanya Kulkarni wrote:
>> In function nvmet_passthru_override_id_ns() while iterating
>> over namespace lba format loop variable is declared as int that is
>> inconsistent with the id->nlbaf type which is u8.
>>
>> Make loop variable of the same type as id->nlbaf.
> The loop is id->nlbaf + 1, so it'd overflow if the nlbaf value is the max
> u8. Sure, it doesn't get that large today, but they're always trying to
> make it bigger. And there's really nothing wrong with counting for loops
> with 'int i' anyway.
> 

In past when ppl run proprietary static checker it has generated
warnings for such cases.



More information about the Linux-nvme mailing list