Re: [PATCH] scsi: Return -EINVAL when "id == max_id" in scsi_scan_host_selected()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



--- Matthew Wilcox <matthew@xxxxxx> wrote:
> So as scsi maintainer, what's your preference for the 'right way' to fix
> this?  Clearly a whole-scale driver audit is needed, so my preference is
> to rename the variable (how about id_limit?) and then do a sweep
> checking that everybody's using it correctly.
> 
> Then we need to do a similar check for max_lun and max_channel.  As far
> as conventions go, I think we should use 8 and 16; it's just so much
> more natural to write 'for (id = 0; id < id_limit; id++)'.

Think about it: "id_limit".  What if I set "id_limit" equal 0?
Does this mean that the last id is 0 or does it mean that are simply no
ids.

The literature calls such things "number of" ("num_of_xyz") or
"maxiumum number of" ("max_num_xyz").

If you called it "num_of_ids" or "max_num_ids" then there is no
ambiguity that what it talks about is the (maximum) _number_ (as in count)
of the ids.  An index can never be >= the count, else BUG.

     Luben
P.S. Then after that patch, seeing that there is no possible enumeration
to ids other tha in an SPI layer, another patch should possibly get rid of it.

-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux