Re: [PATCHv1 4/6] firmware: add Intel Stratix10 remote system update driver

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

 



On Tue, Apr 09, 2019 at 01:46:00PM -0500, richard.gong@xxxxxxxxxxxxxxx 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



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux