linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
To: Harshit Jain <harshitjain6751@gmail.com>
Cc: stable@vger.kernel.org, Harshit Jain <dev-harsh1998@hotmail.com>,
	Tony Finch <dot@dotat.at>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] scripts: unifdef: fix stringop-truncation warning
Date: Fri, 14 Sep 2018 19:12:29 +0200	[thread overview]
Message-ID: <CANiq72=xNMKJv3tT9+-jxEOx9033ytRrbUV+TQ6kVL7QY06jDA@mail.gmail.com> (raw)
In-Reply-To: <20180914104427.3900-1-harshitjain6751@gmail.com>

Hi Harshit,

On Fri, Sep 14, 2018 at 12:44 PM, Harshit Jain
<harshitjain6751@gmail.com> wrote:
> From: Harshit Jain <dev-harsh1998@hotmail.com>
>
> * This commit resolves the following warning when the mainline kernel is build with the android environment.

Typo: built

>
> -> warning :-> https://gist.github.com/dev-harsh1998/757427b16a58f5498db3d87212a9651b

Try to avoid links to external pages (specially if they are only 2 lines :-).

>
> * This warning is persistant in all the currently maintained android kernel i.e 3.18, 4.4, 4.9, 4.14.

Typos: persistent, kernels, i.e.

>
> Signed-off-by: Harshit Jain <dev-harsh1998@hotmail.com>
> ---
>  scripts/unifdef.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/scripts/unifdef.c b/scripts/unifdef.c
> index 7493c0ee51cc..4ce008eda362 100644
> --- a/scripts/unifdef.c
> +++ b/scripts/unifdef.c
> @@ -395,8 +395,8 @@ usage(void)
>   * When we have processed a group that starts off with a known-false
>   * #if/#elif sequence (which has therefore been deleted) followed by a
>   * #elif that we don't understand and therefore must keep, we edit the
> - * latter into a #if to keep the nesting correct. We use strncpy() to
> - * overwrite the 4 byte token "elif" with "if  " without a '\0' byte.
> + * latter into a #if to keep the nesting correct. We use the memcpy()
> + * from the string header overwrite the 4 byte token "elif" with "if  ".
>   *
>   * When we find a true #elif in a group, the following block will
>   * always be kept and the rest of the sequence after the next #elif or
> @@ -450,7 +450,7 @@ static void Idrop (void) { Fdrop();  ignoreon(); }
>  static void Itrue (void) { Ftrue();  ignoreon(); }
>  static void Ifalse(void) { Ffalse(); ignoreon(); }
>  /* modify this line */
> -static void Mpass (void) { strncpy(keyword, "if  ", 4); Pelif(); }
> +static void Mpass (void) { memcpy(keyword, "if  ", 4); Pelif(); }

Seems like keyword shouldn't use __attribute__((nonstring)), so this
looks right.

Cheers,
Miguel

>  static void Mtrue (void) { keywordedit("else");  state(IS_TRUE_MIDDLE); }
>  static void Melif (void) { keywordedit("endif"); state(IS_FALSE_TRAILER); }
>  static void Melse (void) { keywordedit("endif"); state(IS_FALSE_ELSE); }
> --
> 2.18.0
>

  reply	other threads:[~2018-09-14 17:12 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-14 10:44 [PATCH] scripts: unifdef: fix stringop-truncation warning Harshit Jain
2018-09-14 17:12 ` Miguel Ojeda [this message]
2018-09-14 17:18   ` Miguel Ojeda
  -- strict thread matches above, loose matches on Subject: below --
2018-08-17 20:20 Harshit Jain
2018-08-21 15:13 ` Tony Finch
     [not found]   ` <CAA47fTLj32cf=p5LUwZDrtKvXebHDNxz9ozEz9YCoCFP0NRgng@mail.gmail.com>
2018-08-23 11:42     ` Tony Finch

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='CANiq72=xNMKJv3tT9+-jxEOx9033ytRrbUV+TQ6kVL7QY06jDA@mail.gmail.com' \
    --to=miguel.ojeda.sandonis@gmail.com \
    --cc=dev-harsh1998@hotmail.com \
    --cc=dot@dotat.at \
    --cc=harshitjain6751@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).