linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] serial_core: fix sizeof(pointer)
@ 2012-09-06  2:27 Fengguang Wu
  2012-09-06  6:59 ` Jiri Slaby
  2012-09-06 11:48 ` Alan Cox
  0 siblings, 2 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-09-06  2:27 UTC (permalink / raw)
  To: linux-serial; +Cc: Alan Cox, Jiri Slaby, Greg Kroah-Hartman, LKML

sizeof when applied to a pointer typed expression gives the
size of the pointer.

Generated by: scripts/coccinelle/misc/noderef.cocci

Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
---

 cocci-output-38612-39d907-serial_core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -640,7 +640,7 @@ static void uart_get_info(struct tty_por
 {
 	struct uart_port *uport = state->uart_port;
 
-	memset(retinfo, 0, sizeof(retinfo));
+	memset(retinfo, 0, sizeof(*retinfo));
 
 	retinfo->type	    = uport->type;
 	retinfo->line	    = uport->line;

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial_core: fix sizeof(pointer)
  2012-09-06  2:27 [PATCH] serial_core: fix sizeof(pointer) Fengguang Wu
@ 2012-09-06  6:59 ` Jiri Slaby
  2012-09-06  7:08   ` Fengguang Wu
  2012-09-06 11:48 ` Alan Cox
  1 sibling, 1 reply; 4+ messages in thread
From: Jiri Slaby @ 2012-09-06  6:59 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, LKML

On 09/06/2012 04:27 AM, Fengguang Wu wrote:
> sizeof when applied to a pointer typed expression gives the
> size of the pointer.
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> ---
> 
>  cocci-output-38612-39d907-serial_core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/tty/serial/serial_core.c
> +++ b/drivers/tty/serial/serial_core.c
> @@ -640,7 +640,7 @@ static void uart_get_info(struct tty_por
>  {
>  	struct uart_port *uport = state->uart_port;
>  
> -	memset(retinfo, 0, sizeof(retinfo));
> +	memset(retinfo, 0, sizeof(*retinfo));

Hmm, what tree is this against? I have:

memset(&tmp, 0, sizeof(tmp));

thanks,
-- 
js
suse labs

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial_core: fix sizeof(pointer)
  2012-09-06  6:59 ` Jiri Slaby
@ 2012-09-06  7:08   ` Fengguang Wu
  0 siblings, 0 replies; 4+ messages in thread
From: Fengguang Wu @ 2012-09-06  7:08 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: linux-serial, Alan Cox, Greg Kroah-Hartman, LKML

On Thu, Sep 06, 2012 at 08:59:00AM +0200, Jiri Slaby wrote:
> On 09/06/2012 04:27 AM, Fengguang Wu wrote:
> > sizeof when applied to a pointer typed expression gives the
> > size of the pointer.
> > 
> > Generated by: scripts/coccinelle/misc/noderef.cocci
> > 
> > Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>
> > ---
> > 
> >  cocci-output-38612-39d907-serial_core.c |    2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > --- a/drivers/tty/serial/serial_core.c
> > +++ b/drivers/tty/serial/serial_core.c
> > @@ -640,7 +640,7 @@ static void uart_get_info(struct tty_por
> >  {
> >  	struct uart_port *uport = state->uart_port;
> >  
> > -	memset(retinfo, 0, sizeof(retinfo));
> > +	memset(retinfo, 0, sizeof(*retinfo));
> 
> Hmm, what tree is this against? I have:

It's the tty:tty-next tree.

        git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-next

> memset(&tmp, 0, sizeof(tmp));

Oh I didn't know it's a new bug introduced by commit

        commit 7ba2e769825fef035a943ed74d90379245508764
        Author:     Alan Cox <alan@linux.intel.com>
        AuthorDate: Tue Sep 4 16:34:45 2012 +0100
        Commit:     Greg Kroah-Hartman <gregkh@linuxfoundation.org>
        CommitDate: Wed Sep 5 13:11:03 2012 -0700

            tty: Split the serial_core helpers for setserial into two

Thanks,
Fengguang

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] serial_core: fix sizeof(pointer)
  2012-09-06  2:27 [PATCH] serial_core: fix sizeof(pointer) Fengguang Wu
  2012-09-06  6:59 ` Jiri Slaby
@ 2012-09-06 11:48 ` Alan Cox
  1 sibling, 0 replies; 4+ messages in thread
From: Alan Cox @ 2012-09-06 11:48 UTC (permalink / raw)
  To: Fengguang Wu; +Cc: linux-serial, Jiri Slaby, Greg Kroah-Hartman, LKML

On Thu, 6 Sep 2012 10:27:51 +0800
Fengguang Wu <fengguang.wu@intel.com> wrote:

> sizeof when applied to a pointer typed expression gives the
> size of the pointer.
> 
> Generated by: scripts/coccinelle/misc/noderef.cocci
> 
> Signed-off-by: Fengguang Wu <fengguang.wu@intel.com>


Oops.. yes typo on my part

Signed-off-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-09-06 11:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-06  2:27 [PATCH] serial_core: fix sizeof(pointer) Fengguang Wu
2012-09-06  6:59 ` Jiri Slaby
2012-09-06  7:08   ` Fengguang Wu
2012-09-06 11:48 ` Alan Cox

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).