Re: [patch] wireless: at76c50x: allocating too much data

Julian Calaby
2012-04-20T08:57:00Z

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