mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark D Rustad <mrustad@gmail.com>
To: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Linus Walleij <linus.walleij@linaro.org>,
	Wolfram Sang <wsa@the-dreams.de>,
	Peter Hurley <peter@hurleysoftware.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] misc: ti-st: st_kim.c:  Cleaning up missing null-terminate after strncpy call
Date: Sun, 10 Aug 2014 18:01:48 -0700	[thread overview]
Message-ID: <6ACE8FE9-A4AD-4A7A-890F-49F42B81C0A4@gmail.com> (raw)
In-Reply-To: <1407627938-24614-1-git-send-email-rickard_strandqvist@spectrumdigital.se>

[-- Attachment #1: Type: text/plain, Size: 987 bytes --]

On Aug 9, 2014, at 4:45 PM, Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se> wrote:

> Added a guaranteed null-terminate after call to strncpy.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> ---
> drivers/misc/ti-st/st_kim.c |    1 +
> 1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/misc/ti-st/st_kim.c b/drivers/misc/ti-st/st_kim.c
> index 9d3dbb2..bce4468 100644
> --- a/drivers/misc/ti-st/st_kim.c
> +++ b/drivers/misc/ti-st/st_kim.c
> @@ -593,6 +593,7 @@ static ssize_t store_dev_name(struct device *dev,
> 	struct kim_data_s *kim_data = dev_get_drvdata(dev);
> 	pr_debug("storing dev name >%s<", buf);
> 	strncpy(kim_data->dev_name, buf, count);
> +	kim_data->dev_name[count - 1] = '\n';

Of course this does not add termination, but adds a newline at the end of the buffer? Huh?

> 	pr_debug("stored dev name >%s<", kim_data->dev_name);
> 	return count;
> }

-- 
Mark Rustad, MRustad@gmail.com


[-- Attachment #2: Message signed with OpenPGP using GPGMail --]
[-- Type: application/pgp-signature, Size: 841 bytes --]

  reply	other threads:[~2014-08-11  1:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-09 23:45 Rickard Strandqvist
2014-08-11  1:01 ` Mark D Rustad [this message]
2014-08-11  9:14   ` Wolfram Sang
2014-08-11 19:45     ` Rickard Strandqvist

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=6ACE8FE9-A4AD-4A7A-890F-49F42B81C0A4@gmail.com \
    --to=mrustad@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=peter@hurleysoftware.com \
    --cc=rickard_strandqvist@spectrumdigital.se \
    --cc=wsa@the-dreams.de \
    /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

all inboxes | Powered by JetHome®