* re: Input: gamecon - use parallel port device model
@ 2015-10-01 22:05 Dan Carpenter
2015-10-02 5:39 ` Sudip Mukherjee
0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-01 22:05 UTC (permalink / raw)
To: sudipm.mukherjee; +Cc: linux-input
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
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Input: gamecon - use parallel port device model
2015-10-01 22:05 Input: gamecon - use parallel port device model Dan Carpenter
@ 2015-10-02 5:39 ` Sudip Mukherjee
0 siblings, 0 replies; 2+ messages in thread
From: Sudip Mukherjee @ 2015-10-02 5:39 UTC (permalink / raw)
To: Dan Carpenter; +Cc: linux-input
On Fri, Oct 02, 2015 at 01:05:32AM +0300, Dan Carpenter wrote:
> 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++) {
> ^^^^^^^^^^^^^^
Thanks Dan. This would have been an ugly mess. I checked my othher
patches and looks like they will also have the same mistake. I will send
the patch to fix this rightaway.
Thanks again.
regards
sudip
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-10-02 5:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-01 22:05 Input: gamecon - use parallel port device model Dan Carpenter
2015-10-02 5:39 ` Sudip Mukherjee
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).