Re: [RFC PATCH v2 7/7] nvme: Add durable name for dev_printk

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

 



On Wed, May 13, 2020 at 04:36:21PM -0500, Tony Asleson wrote:
> +static int dev_to_nvme_durable_name(const struct device *dev, char *buf, size_t len)
> +{
> +	char serial[128];
> +	ssize_t serial_len = wwid_show((struct device *)dev, NULL, serial);

wwid_show() can generate a serial larger than 128 bytes.

> +
> +	if (serial_len > 0 && serial_len < len) {
> +		serial_len -= 1;  // Remove the '\n' from the string

Comments in this driver should use the /* */ style.

> +		strncpy(buf, serial, serial_len);
> +		return serial_len;
> +	}
> +	return 0;
> +}



[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux