On Tue, Jun 30, 2015 at 05:22:20AM +0000, Seymour, Shane M wrote:
> 
> Changed DEVICE_ATTR macro usage to DEVICE_ATTR_RO|WO|RW.
> This also forced some show/store function names to change.
> 
> Changed all show method sprint/snprintf usage to scnprintf per
> Documentation/filesystems/sysfs.txt.

There's no need to change sprintf() to scnprintf() at all, that's just
useless churn.

> 
> Signed-off-by: Shane Seymour <[email protected]>
> ---
> --- a/drivers/scsi/hpsa.c     2015-06-25 15:52:15.633031319 -0500
> +++ b/drivers/scsi/hpsa.c     2015-06-29 17:28:24.628475369 -0500
> @@ -376,7 +376,7 @@ static int check_for_busy(struct ctlr_in
>  }
>  
>  static u32 lockup_detected(struct ctlr_info *h);
> -static ssize_t host_show_lockup_detected(struct device *dev,
> +static ssize_t lockup_detected_show(struct device *dev,
>               struct device_attribute *attr, char *buf)
>  {
>       int ld;
> @@ -386,10 +386,10 @@ static ssize_t host_show_lockup_detected
>       h = shost_to_hba(shost);
>       ld = lockup_detected(h);
>  
> -     return sprintf(buf, "ld=%d\n", ld);
> +     return scnprintf(buf, PAGE_SIZE, "ld=%d\n", ld);

Like here, it's obvious that the original will never overflow, so don't
even worry about checking, it's pointless.

So please don't change this.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-api" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to