Changed from using strncat to strlcat to simplify the code Signed-off-by: Rickard Strandqvist <rickard_strandqvist@xxxxxxxxxxxxxxxxxx> Reviewed-by: Ian Abbott <abbotti@xxxxxxxxx> Reviewed-by: H Hartley Sweeten <hsweeten@xxxxxxxxxxxxxxxxxxx> --- drivers/staging/comedi/drivers/comedi_bond.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/comedi_bond.c b/drivers/staging/comedi/drivers/comedi_bond.c index 8450c99..85b2f4a 100644 --- a/drivers/staging/comedi/drivers/comedi_bond.c +++ b/drivers/staging/comedi/drivers/comedi_bond.c @@ -61,8 +61,7 @@ struct bonded_device { }; struct comedi_bond_private { -# define MAX_BOARD_NAME 256 - char name[MAX_BOARD_NAME]; + char name[256]; struct bonded_device **devs; unsigned ndevs; unsigned nchans; @@ -262,12 +261,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)); } } -- 1.7.10.4 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel