All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julian Calaby <julian.calaby@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] wireless: at76c50x: allocating too much data
Date: Fri, 20 Apr 2012 18:57:00 +1000	[thread overview]
Message-ID: <CAGRGNgVgtAYknmpB_8Q0OpcUWFjTxBistG+RNs1ORDZeckGsWw@mail.gmail.com> (raw)
In-Reply-To: <20120420064705.GE22649@elgon.mountain>

Hi Dan,

On Fri, Apr 20, 2012 at 16:47, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This is a cut and paste mistake, sizeof(struct mib_local) was intended
> instead of sizeof(struct mib_phy).  The call to at76_get_mib() uses
> sizeof(struct mib_local) correctly.
>
> The current code works fine because mib_phy structs are larger than
> mib_local structs.  But we may as well clean it up.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
> index faa8bcb..0bba5ea 100644
> --- a/drivers/net/wireless/at76c50x-usb.c
> +++ b/drivers/net/wireless/at76c50x-usb.c
> @@ -1122,7 +1122,7 @@ exit:
>  static void at76_dump_mib_local(struct at76_priv *priv)
>  {
>        int ret;
> -       struct mib_local *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
> +       struct mib_local *m = kmalloc(sizeof(struct mib_local), GFP_KERNEL);

Would it be better practice to use sizeof(*m)?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/

WARNING: multiple messages have this Message-ID (diff)
From: Julian Calaby <julian.calaby@gmail.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: "John W. Linville" <linville@tuxdriver.com>,
	linux-wireless@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [patch] wireless: at76c50x: allocating too much data
Date: Fri, 20 Apr 2012 08:57:00 +0000	[thread overview]
Message-ID: <CAGRGNgVgtAYknmpB_8Q0OpcUWFjTxBistG+RNs1ORDZeckGsWw@mail.gmail.com> (raw)
In-Reply-To: <20120420064705.GE22649@elgon.mountain>

Hi Dan,

On Fri, Apr 20, 2012 at 16:47, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This is a cut and paste mistake, sizeof(struct mib_local) was intended
> instead of sizeof(struct mib_phy).  The call to at76_get_mib() uses
> sizeof(struct mib_local) correctly.
>
> The current code works fine because mib_phy structs are larger than
> mib_local structs.  But we may as well clean it up.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> diff --git a/drivers/net/wireless/at76c50x-usb.c b/drivers/net/wireless/at76c50x-usb.c
> index faa8bcb..0bba5ea 100644
> --- a/drivers/net/wireless/at76c50x-usb.c
> +++ b/drivers/net/wireless/at76c50x-usb.c
> @@ -1122,7 +1122,7 @@ exit:
>  static void at76_dump_mib_local(struct at76_priv *priv)
>  {
>        int ret;
> -       struct mib_local *m = kmalloc(sizeof(struct mib_phy), GFP_KERNEL);
> +       struct mib_local *m = kmalloc(sizeof(struct mib_local), GFP_KERNEL);

Would it be better practice to use sizeof(*m)?

Thanks,

-- 
Julian Calaby

Email: julian.calaby@gmail.com
Profile: http://www.google.com/profiles/julian.calaby/
.Plan: http://sites.google.com/site/juliancalaby/
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2012-04-20  8:57 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-20  6:47 [patch] wireless: at76c50x: allocating too much data Dan Carpenter
2012-04-20  6:47 ` Dan Carpenter
2012-04-20  8:57 ` Julian Calaby [this message]
2012-04-20  8:57   ` Julian Calaby
2012-04-20  9:14   ` Dan Carpenter
2012-04-20  9:14     ` Dan Carpenter
2012-04-20 18:14     ` Kalle Valo
2012-04-20 18:14       ` Kalle Valo
2012-04-21 12:23       ` [patch v2] " Dan Carpenter
2012-04-21 12:23         ` Dan Carpenter
2012-04-21 12:45       ` [patch] " Dan Carpenter
2012-04-21 12:45         ` Dan Carpenter
2012-04-21 13:19         ` Julia Lawall
2012-04-21 13:19           ` Julia Lawall
2012-04-21 13:51         ` Julia Lawall
2012-04-21 13:51           ` Julia Lawall
2012-04-21 14:51           ` Dan Carpenter
2012-04-21 14:51             ` Dan Carpenter
2012-04-21 14:51             ` Julia Lawall
2012-04-21 14:51               ` Julia Lawall
2012-04-21 14:59             ` Dan Carpenter
2012-04-21 14:59               ` Dan Carpenter
2012-04-21 15:12             ` Dan Carpenter
2012-04-21 15:12               ` Dan Carpenter
2012-04-21 15:13               ` Julia Lawall
2012-04-21 15:13                 ` Julia Lawall

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=CAGRGNgVgtAYknmpB_8Q0OpcUWFjTxBistG+RNs1ORDZeckGsWw@mail.gmail.com \
    --to=julian.calaby@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.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 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.