From: Joe Perches <joe@perches.com>
To: "Tobin C. Harding" <me@tobin.cc>,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
noralf@tronnes.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 2/3] staging: fbtft: Replace magic number with constant
Date: Tue, 14 Feb 2017 19:36:28 -0800 [thread overview]
Message-ID: <1487129788.6214.41.camel@perches.com> (raw)
In-Reply-To: <1487129245-24970-3-git-send-email-me@tobin.cc>
On Wed, 2017-02-15 at 14:27 +1100, Tobin C. Harding wrote:
> Current call to strncmp() uses a magic number. There is a compile
> time constant defined for this buffer, included and used already at
> other sites in the file.
>
> Remove magic number. Replace with pre-existing compile time constant.
OK thanks, as well:
> diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
[]
> @@ -1489,7 +1489,7 @@ static int __init fbtft_device_init(void)
> }
>
> for (i = 0; i < ARRAY_SIZE(displays); i++) {
> - if (strncmp(name, displays[i].name, 32) == 0) {
> + if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) {
Maybe change this to:
if (strncmp(name, displays[i].name, SPI_NAME_SIZE) != 0)
continue;
and reduce the indentation of the rest of the block.
next prev parent reply other threads:[~2017-02-15 3:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-15 3:27 [PATCH v2 0/3] staging: fbtft: Fix buffer overflow vulnerability Tobin C. Harding
2017-02-15 3:27 ` [PATCH v2 1/3] " Tobin C. Harding
2017-02-15 3:27 ` [PATCH v2 2/3] staging: fbtft: Replace magic number with constant Tobin C. Harding
2017-02-15 3:36 ` Joe Perches [this message]
2017-02-15 3:27 ` [PATCH v2 3/3] staging: fbtft: Add check on strlcpy() return value Tobin C. Harding
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=1487129788.6214.41.camel@perches.com \
--to=joe@perches.com \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=me@tobin.cc \
--cc=noralf@tronnes.org \
--cc=thomas.petazzoni@free-electrons.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.