Re: [RFC PATCH rdma-next v2] RDMA/srp: Rename SRP sysfs name after IB device rename trigger

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

 



On 5/15/19 7:06 PM, Leon Romanovsky wrote:
> +	list_for_each_entry_safe(host, tmp_host, &srp_dev->dev_list, list) {
> +		char name[IB_DEVICE_NAME_MAX * 2] = {};
                          ^^^^^^^^^^^^^^^^^^^^^^
I think this should be IB_DEVICE_NAME_MAX + 8 instead of ... * 2. Please
also consider to leave out the initialization of the char array since
snprintf() overwrites the array whether or not it has been initialized.

> +		snprintf(name, IB_DEVICE_NAME_MAX * 2, "srp-%s-%d",
                               ^^^^^^^^^^^^^^^^^^^^^^
Please change this into sizeof(name) such that the size expression only
occurs once.

Thanks,

Bart.




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux