lkml.org 
[lkml]   [2019]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCHv1 4/6] firmware: add Intel Stratix10 remote system update driver
On Tue, Apr 09, 2019 at 01:46:00PM -0500, richard.gong@linux.intel.com wrote:
> +/*
> + * This driver exposes some optional features of the Intel Stratix 10 SoC FPGA.
> + * The SysFS interfaces exposed here are FPGA Remote System Update (RSU)

It has never been "SysFS", it has always been "sysfs".

> + * related. They allow user space software to query the configuration system
> + * status and to request optional reboot behavior specific to Intel FPGAs.
> + */
> +
> +static ssize_t current_image_show(struct device *dev,
> + struct device_attribute *attr, char *buf)
> +{
> + struct stratix10_rsu_priv *priv = dev_get_drvdata(dev);
> +
> + if (!priv)
> + return -ENODEV;
> +
> + return scnprintf(buf, PAGE_SIZE, "%ld", priv->status.current_image);

While it is all nice and fine to try to be "safe" and use scnprintf() it
turns out that if you EVER care about the size of a sysfs buffer, your
code is doing something wrong. This can just be a simple sprintf()
call.

Same goes for everywhere in this file.

thanks,

greg k-h

\
 
 \ /
  Last update: 2019-04-25 22:31    [W:0.670 / U:0.076 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site