From: "Tobin C. Harding" <me@tobin.cc>
To: 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,
"Tobin C. Harding" <me@tobin.cc>
Subject: [PATCH v2 2/3] staging: fbtft: Replace magic number with constant
Date: Wed, 15 Feb 2017 14:27:24 +1100 [thread overview]
Message-ID: <1487129245-24970-3-git-send-email-me@tobin.cc> (raw)
In-Reply-To: <1487129245-24970-1-git-send-email-me@tobin.cc>
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.
Signed-off-by: Tobin C. Harding <me@tobin.cc>
---
drivers/staging/fbtft/fbtft_device.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c
index 7b7223b..5fbdd37 100644
--- 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) {
if (displays[i].spi) {
spi = displays[i].spi;
spi->chip_select = cs;
--
2.7.4
next prev parent reply other threads:[~2017-02-15 3:27 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 ` Tobin C. Harding [this message]
2017-02-15 3:36 ` [PATCH v2 2/3] staging: fbtft: Replace magic number with constant Joe Perches
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=1487129245-24970-3-git-send-email-me@tobin.cc \
--to=me@tobin.cc \
--cc=devel@driverdev.osuosl.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox