Re: [PATCH] staging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat

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

 



2014-10-13 11:14 GMT+02:00 Ian Abbott <abbotti@xxxxxxxxx>:
> On 12/10/14 13:23, Rickard Strandqvist wrote:
>>
>> Changed from using strncat to strlcat to simplify the code
>>
>> Signed-off-by: Rickard Strandqvist
>> <rickard_strandqvist@xxxxxxxxxxxxxxxxxx>
>> ---
>>   drivers/staging/comedi/drivers/comedi_bond.c |    6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/staging/comedi/drivers/comedi_bond.c
>> b/drivers/staging/comedi/drivers/comedi_bond.c
>> index 8450c99..5d19861 100644
>> --- a/drivers/staging/comedi/drivers/comedi_bond.c
>> +++ b/drivers/staging/comedi/drivers/comedi_bond.c
>> @@ -262,12 +262,10 @@ static int do_dev_config(struct comedi_device *dev,
>> struct comedi_devconfig *it)
>>                         {
>>                                 /* Append dev:subdev to devpriv->name */
>>                                 char buf[20];
>> -                               int left =
>> -                                   MAX_BOARD_NAME - strlen(devpriv->name)
>> - 1;
>>                                 snprintf(buf, sizeof(buf), "%u:%u ",
>>                                          bdev->minor, bdev->subdev);
>> -                               buf[sizeof(buf) - 1] = 0;
>> -                               strncat(devpriv->name, buf, left);
>> +                               strlcat(devpriv->name, buf,
>> +                                       sizeof(devpriv->name));
>>                         }
>>
>>                 }
>>
>
> Looks good.  Additionally, the #define MAX_BOARD_NAME could be eliminated as
> now it is only used to to set the length of the 'name' member in 'struct
> comedi_bond_private'.
>
> Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx>


Hi

Sounds like a good idea Ian.
I'll send a new patch where I removed the MAX_BOARD_NAME  tomorrow.


Kind regards
Rickard Strandqvist
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux