From: Dan Carpenter <dan.carpenter@oracle.com>
To: sudipm.mukherjee@gmail.com
Cc: linux-input@vger.kernel.org
Subject: re: Input: gamecon - use parallel port device model
Date: Fri, 2 Oct 2015 01:05:32 +0300 [thread overview]
Message-ID: <20151001220532.GA493@mwanda> (raw)
Hello Sudip Mukherjee,
The patch a517e87c3dfc: "Input: gamecon - use parallel port device
model" from Sep 29, 2015, leads to the following static checker
warning:
drivers/input/joystick/gamecon.c:988 gc_attach()
error: buffer overflow 'gc_base' 3 <= 5
drivers/input/joystick/gamecon.c
972
973 for (i = 0; i < n_pads && i < GC_MAX_DEVICES; i++) {
^^^^^^^^^^^^^^
Should this be GC_MAX_PORTS?
974 if (!pads[i])
975 continue;
976
977 if (gc_setup_pad(gc, i, pads[i]))
978 goto err_unreg_devs;
979
980 count++;
981 }
982
983 if (count == 0) {
984 pr_err("No valid devices specified\n");
985 goto err_free_gc;
986 }
987
988 gc_base[i] = gc;
^^^^^^^^^^
It's saying this is out of bounds.
Even if we change GC_MAX_DEVICES to GC_MAX_PORTS it will still complain
because we are relying on n_pads to be less than GC_MAX_DEVICES. I
guess we could change the other condition to be:
if (count == 0 || i == GC_MAX_PORTS)
goto err_free_gc;
989 return;
990
regards,
dan carpenter
next reply other threads:[~2015-10-01 22:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-01 22:05 Dan Carpenter [this message]
2015-10-02 5:39 ` Input: gamecon - use parallel port device model Sudip Mukherjee
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=20151001220532.GA493@mwanda \
--to=dan.carpenter@oracle.com \
--cc=linux-input@vger.kernel.org \
--cc=sudipm.mukherjee@gmail.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