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

Logan Gunthorpe logang at deltatee.com
Tue Sep 1 17:31:07 EDT 2020



On 2020-09-01 3:17 p.m., Chaitanya Kulkarni wrote:
> 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.

I'd ignore such warnings. Sounds like the proprietary tool is producing
ridiculous false positives. And, per Keith's example, is just making the
code wrong for no reason.

Logan



More information about the Linux-nvme mailing list