All of lore.kernel.org
 help / color / mirror / Atom feed
From: Willy Tarreau <w@1wt.eu>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] staging: panel: pass correct lengths to keypad_send_key()
Date: Sun, 02 Dec 2012 11:53:06 +0000	[thread overview]
Message-ID: <20121202115306.GP25450@1wt.eu> (raw)
In-Reply-To: <20121129143835.GC12199@elgon.mountain>

Hi Dan,

On Sun, Dec 02, 2012 at 02:22:13PM +0300, Dan Carpenter wrote:
> On Fri, Nov 30, 2012 at 10:19:06AM +0100, walter harms wrote:
> > >  				if (press_str[0])
> > >  					keypad_send_key(press_str,
> > > -							sizeof(press_str));
> > > +							sizeof(input->u.kbd.press_str));
> > >  			}
> > yep, this looks like the original intention.
> > NTL i would like to question the use of  press_str and friends.
> > Moving the if (press_str[0]) into keypad_send_key() seems
> > more sensible.
> > 
> > just my two cents,
> > 
> 
> Greg had already applied my patch by the you sent this email.
> 
> What you're saying sounds like it should be a good cleanup, but when
> I actually look at it, the callers still have to test repeat_str[0]
> so it's not as useful as one would hope.
> 
> Really this stuff is really confusing.  I'm not sure what is
> actually stored in press_str.  Is it a pointer or just chars?  If
> it's a pointer then why are we only checking the first bit instead
> of checking the pointer?  I think it's characters but why is it
> declared as "char press_str[sizeof(void *) + sizeof(int)];"?

It's just chars. It was declared this way so that it did not
inflate the union it's declared in. This is totally ugly and
should be cleaned. But it dates 13 years ago when we were trying
to shrink everything to have full-featured kernels in less than
500kB to boot from floppies...

Regards,
Willy


  parent reply	other threads:[~2012-12-02 11:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-29 14:38 [patch] staging: panel: pass correct lengths to keypad_send_key() Dan Carpenter
2012-11-30  9:19 ` walter harms
2012-12-01  8:08 ` Willy Tarreau
2012-12-01  8:13 ` Willy Tarreau
2012-12-02 11:22 ` Dan Carpenter
2012-12-02 11:53 ` Willy Tarreau [this message]
2012-12-02 15:44 ` walter harms

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=20121202115306.GP25450@1wt.eu \
    --to=w@1wt.eu \
    --cc=kernel-janitors@vger.kernel.org \
    /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.