From: David Laight <David.Laight@ACULAB.COM>
To: "'Christophe LEROY'" <christophe.leroy@c-s.fr>,
Geert Uytterhoeven <geert@linux-m68k.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
Paul Mackerras <paulus@samba.org>,
Michael Ellerman <mpe@ellerman.id.au>,
"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
linuxppc-dev <linuxppc-dev@lists.ozlabs.org>,
Geoff Levand <geoff@infradead.org>
Subject: RE: [PATCH v2] powerpc/64: Fix build failure with GCC 8.1
Date: Tue, 29 May 2018 15:24:21 +0000 [thread overview]
Message-ID: <1bfdea64b0cc4be2970e296684c097dc@AcuMS.aculab.com> (raw)
In-Reply-To: <3a438dd8-49c3-ad39-e2a1-040e0ce67279@c-s.fr>
From: Christophe LEROY
> Sent: 29 May 2018 10:37
...
> >>>> - strncpy(new_part->header.name, name, 12);
> >>>> + memcpy(new_part->header.name, name, strnlen(name,
> >>>> sizeof(new_part->header.name)));
> >>>
> >>>
> >>> The comment for nvram_header.lgnth says:
> >>>
> >>> /* Terminating null required only for names < 12 chars. */
> >>>
> >>> This will not terminate the string with a zero (the struct is
> >>> allocated with kmalloc).
> >>> So the original code is correct, the new one isn't.
> >>
> >> Right, then I have to first zeroize the destination.
> >
> > Using kzalloc() instead of kmalloc() will do.
> >
> > Still, papering around these warnings seems to obscure things, IMHO.
> > And it increases code size, as you had to add a call to strnlen().
>
> Right but then, what is the best solution to elimate that warning ?
Time to add the I_really_mean_strncy() function.
David
next prev parent reply other threads:[~2018-05-29 15:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-29 6:03 [PATCH v2] powerpc/64: Fix build failure with GCC 8.1 Christophe Leroy
2018-05-29 7:47 ` Geert Uytterhoeven
2018-05-29 8:56 ` Christophe LEROY
2018-05-29 9:05 ` Geert Uytterhoeven
2018-05-29 9:37 ` Christophe LEROY
2018-05-29 15:24 ` David Laight [this message]
2018-05-31 5:54 ` Michael Ellerman
2018-05-31 5:57 ` Christophe LEROY
2018-05-31 11:17 ` Michael Ellerman
2018-06-04 14:11 ` [v2] " Michael Ellerman
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=1bfdea64b0cc4be2970e296684c097dc@AcuMS.aculab.com \
--to=david.laight@aculab.com \
--cc=benh@kernel.crashing.org \
--cc=christophe.leroy@c-s.fr \
--cc=geert@linux-m68k.org \
--cc=geoff@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=paulus@samba.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