From: Ian Abbott <abbotti@mev.co.uk>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>,
H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Chase Southwood <chase.southwood@yahoo.com>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] staging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat
Date: Mon, 13 Oct 2014 10:14:34 +0100 [thread overview]
Message-ID: <543B97FA.8050207@mev.co.uk> (raw)
In-Reply-To: <1413116604-18554-1-git-send-email-rickard_strandqvist@spectrumdigital.se>
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@spectrumdigital.se>
> ---
> 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@mev.co.uk>
--
-=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=-
-=( Web: http://www.mev.co.uk/ )=-
next prev parent reply other threads:[~2014-10-13 9:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-12 12:23 [PATCH] staging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat Rickard Strandqvist
2014-10-13 9:14 ` Ian Abbott [this message]
2014-10-13 20:38 ` Rickard Strandqvist
2014-10-14 17:10 ` Hartley Sweeten
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=543B97FA.8050207@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=chase.southwood@yahoo.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=hsweeten@visionengravers.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rickard_strandqvist@spectrumdigital.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox