From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Divya Bharathi <divya27392@gmail.com>,
Darren Hart <dvhart@infradead.org>,
LKML <linux-kernel@vger.kernel.org>,
Platform Driver <platform-driver-x86@vger.kernel.org>,
Divya Bharathi <divya_bharathi@dell.com>,
mark gross <mgross@linux.intel.com>,
Mario Limonciello <mario.limonciello@dell.com>,
Prasanth KSR <prasanth.ksr@dell.com>
Subject: Re: [PATCH v3] Introduce support for Systems Management Driver over WMI for Dell Systems
Date: Mon, 21 Sep 2020 15:08:57 +0300 [thread overview]
Message-ID: <CAHp75VdOYk0xRKPzTygAMiEiSAmJZBrawZKSjPHiwzd8AbXfiQ@mail.gmail.com> (raw)
In-Reply-To: <CAHp75VcgVgSH6CLr78wfoK8fQVGk2g1x7CK+pAqmMcUDXHoa8w@mail.gmail.com>
On Mon, Sep 21, 2020 at 3:08 PM Andy Shevchenko
<andy.shevchenko@gmail.com> wrote:
> On Mon, Sep 21, 2020 at 2:38 PM Hans de Goede <hdegoede@redhat.com> wrote:
> > On 9/17/20 8:55 AM, Divya Bharathi wrote:
>
> ...
>
> > Now I see that you try to correctly deal with strncpy-s nastiness
> > everywhere, but please just don't use it all.
> > Not using strncpy at all is much better.
> >
> > A lot of the strncpy usage is hidden in:
> >
> > strncpy_attr(char *dest, char *src)
> > {
> > size_t len = strlen(src) + 1;
> >
> > if (len > 1 && len < MAX_BUFF)
> > strncpy(dest, src, len);
> > }
> >
> > Why is there no warning printed when the source string
> > is too long ? Now we just quietly throw away the
> > data, which seems undesirable.
> >
> > Also wouldn't truncating the data to fit in MAX_BUFF be better?
> > (honest question, I do not know which option is better)
>
> And don't forget new compiler warning if it can prove that string will
> be NUL-terminated.
can -> can't
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2020-09-21 12:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 6:55 [PATCH v3] Introduce support for Systems Management Driver over WMI for Dell Systems Divya Bharathi
2020-09-17 12:01 ` kernel test robot
2020-09-21 10:57 ` Hans de Goede
2020-09-21 18:23 ` Limonciello, Mario
2020-09-23 10:19 ` Hans de Goede
2020-09-21 11:38 ` Hans de Goede
2020-09-21 12:08 ` Andy Shevchenko
2020-09-21 12:08 ` Andy Shevchenko [this message]
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=CAHp75VdOYk0xRKPzTygAMiEiSAmJZBrawZKSjPHiwzd8AbXfiQ@mail.gmail.com \
--to=andy.shevchenko@gmail.com \
--cc=divya27392@gmail.com \
--cc=divya_bharathi@dell.com \
--cc=dvhart@infradead.org \
--cc=hdegoede@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mario.limonciello@dell.com \
--cc=mgross@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=prasanth.ksr@dell.com \
/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).