[bug report] scsi: myrs: Add Mylex RAID controller (SCSI interface)

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

 



Hello Hannes Reinecke,

The patch 77266186397c: "scsi: myrs: Add Mylex RAID controller (SCSI
interface)" from Oct 17, 2018 (linux-next), leads to the following
Smatch static checker warning:

	drivers/scsi/myrs.c:1508 disable_enclosure_messages_store()
	warn: no lower bound on 'value' rl='s32min-2'

drivers/scsi/myrs.c
    1494 static ssize_t disable_enclosure_messages_store(struct device *dev,
    1495                 struct device_attribute *attr, const char *buf, size_t count)
    1496 {
    1497         struct scsi_device *sdev = to_scsi_device(dev);
    1498         struct myrs_hba *cs = shost_priv(sdev->host);
    1499         int value, ret;
                 ^^^^^^^^^

    1500 
    1501         ret = kstrtoint(buf, 0, &value);
    1502         if (ret)
    1503                 return ret;
    1504 
    1505         if (value > 2)

Smatch is complaining about negative values of value.  Why is 2 allowed
when ->disable_enc_msg is a bool?  We have a kstrtobool() function as
well, btw.

This is from an unpublished Smatch check but I'm working on it to get
it ready to release.

    1506                 return -EINVAL;
    1507 
--> 1508         cs->disable_enc_msg = value;
    1509         return count;
    1510 }

regards,
dan carpenter



[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