On Mon, 31 Jan 2011 15:09:23 +0100, Wolfram Sang wrote:
> Use strlcpy instead of strncpy.
> 
> Signed-off-by: Wolfram Sang <[email protected]>
> Cc: Linus Walleij <[email protected]>
> Cc: Ben Dooks <[email protected]>

Acked-by: Jean Delvare <[email protected]>

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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to