Re: [PATCH] i2c-stu300: make sure adapter-name is terminated

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

 



On Mon, 31 Jan 2011 15:09:23 +0100, Wolfram Sang wrote:
> Use strlcpy instead of strncpy.
> 
> Signed-off-by: Wolfram Sang <w.sang@xxxxxxxxxxxxxx>
> Cc: Linus Walleij <linus.walleij@xxxxxxxxxxxxxx>
> Cc: Ben Dooks <ben-linux@xxxxxxxxx>

Acked-by: Jean Delvare <khali@xxxxxxxxxxxx>

Ben, please apply.

> ---
> 
> Have been bitten by this, too. Thanks to Ben for spotting it in my driver.
> This was the only occurence in i2c/busses.

I wish strncpy was removed from the kernel altogether.

> 
>  drivers/i2c/busses/i2c-stu300.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
> index 495be45..266135d 100644
> --- a/drivers/i2c/busses/i2c-stu300.c
> +++ b/drivers/i2c/busses/i2c-stu300.c
> @@ -942,7 +942,7 @@ stu300_probe(struct platform_device *pdev)
>  	adap->owner = THIS_MODULE;
>  	/* DDC class but actually often used for more generic I2C */
>  	adap->class = I2C_CLASS_DDC;
> -	strncpy(adap->name, "ST Microelectronics DDC I2C adapter",
> +	strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
>  		sizeof(adap->name));
>  	adap->nr = bus_nr;
>  	adap->algo = &stu300_algo;


-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux GPIO]     [Linux SPI]     [Linux Hardward Monitoring]     [LM Sensors]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux