On 03/02/2014 09:34 AM, Bart Van Assche wrote:
> On 02/13/14 11:28, Hannes Reinecke wrote:
>>  static ssize_t
>> -show_iostat_counterbits(struct device *dev, struct device_attribute *attr,  
>>                         char *buf)
>> +show_vpd_pg(const unsigned char *pg_buf, int pg_len, char *buf)
>> +{
>> +    int len = 0, i;
>> +
>> +    if (!pg_buf)
>> +            return -EINVAL;
>> +
>> +    len = 0;
>> +    for (i = 0; i < pg_len; i += 16) {
>> +            hex_dump_to_buffer(pg_buf + i, pg_len, 16, 1,
>> +                               buf + len, PAGE_SIZE, false);
>> +            strcat(buf + len, "\n");
>> +            len += strlen(buf + len);
>> +    }
>> +    return len;
>> +}
> 
> It might be a good idea to add the output buffer length as an argument
> in show_vpd_pg() and to check explicitly whether or not there is
> sufficient space left in the output buffer.
> 
Good point. Will be doing so.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                   zSeries & Storage
[email protected]                          +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to