lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 28 Nov 2013 12:24:28 +0800
From:	Chen Gang <gang.chen.5i5j@...il.com>
To:	Dmitry Torokhov <dmitry.torokhov@...il.com>
CC:	floe@...terbrot.org, rydberg@...omail.se,
	David Herrmann <dh.herrmann@...il.com>,
	rkuo <rkuo@...eaurora.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	linux-input@...r.kernel.org
Subject: Re: [PATCH] drivers: input: touchscreen: sur40: use static variable
 instead of stack varialbe for 'packet_id'

On 11/28/2013 12:07 PM, Dmitry Torokhov wrote:
> Hi Chen,
> 
> On Wed, Nov 27, 2013 at 10:15:33AM +0800, Chen Gang wrote:
>> > 'packet_id' is used for checking sequence whether in order, it need be
>> > static variable independent from sur40_poll().
>> > 
>> > The related warning (with allmodconfig under hexagon):
>> > 
>> >   drivers/input/touchscreen/sur40.c: In function 'sur40_poll':
>> >   drivers/input/touchscreen/sur40.c:297:6: warning: 'packet_id' may be used uninitialized in this function [-Wuninitialized]
>> > 
>> > 
>> > Signed-off-by: Chen Gang <gang.chen.5i5j@...il.com>
>> > ---
>> >  drivers/input/touchscreen/sur40.c |    2 +-
>> >  1 files changed, 1 insertions(+), 1 deletions(-)
>> > 
>> > diff --git a/drivers/input/touchscreen/sur40.c b/drivers/input/touchscreen/sur40.c
>> > index cfd1b7e..5dfd01a 100644
>> > --- a/drivers/input/touchscreen/sur40.c
>> > +++ b/drivers/input/touchscreen/sur40.c
>> > @@ -251,7 +251,7 @@ static void sur40_poll(struct input_polled_dev *polldev)
>> >  	struct sur40_state *sur40 = polldev->private;
>> >  	struct input_dev *input = polldev->input;
>> >  	int result, bulk_read, need_blobs, packet_blobs, i;
>> > -	u32 packet_id;
>> > +	static u32 packet_id;
> It is usually not a good idea to use statics in device drivers as it
> does not work well when you have several devices of the same type
> present in a system. Also, we process all blobs in one pass so there is
> no need to preserve value of packet_id between calls to sur40_poll().

OK, thanks, I will/should send patch v2 for it.

-- 
Chen Gang
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists