Re: [PATCH 2/3] scsi: read host_busy via scsi_host_busy()

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

 



On Fri, 2018-04-20 at 14:57 +0800, Ming Lei wrote:
>  show_host_busy(struct device *dev, struct device_attribute *attr, char *buf)
>  {
>  	struct Scsi_Host *shost = class_to_shost(dev);
> -	return snprintf(buf, 20, "%d\n", atomic_read(&shost->host_busy));
> +	return snprintf(buf, 20, "%d\n", scsi_host_busy(shost));
>  }
>  static DEVICE_ATTR(host_busy, S_IRUGO, show_host_busy, NULL);

The ", 20" part is cargo-cult programming. Since you have to touch this code,
please either use "sprintf(buf, ...)" or use "scnprintf(buf, PAGE_SIZE, ...)".

Thanks,

Bart.







[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