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  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Sat, 17 Mar 2012 16:44:14 +0000
From:	Arnd Bergmann <arnd@...db.de>
To:	Mircea Gherzan <mgherzan@...il.com>
Cc:	Luciano Coelho <coelho@...com>,
	"John W. Linville" <linville@...driver.com>,
	linux-wireless@...r.kernel.org, netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] wl12xx: fix DMA-API-related warnings

On Saturday 17 March 2012, Mircea Gherzan wrote:
>  int wl1271_event_handle(struct wl1271 *wl, u8 mbox_num)
>  {
> -       struct event_mailbox mbox;
> -       int ret;
> +       struct event_mailbox *mbox;
> +       int ret = 0;
>  
>         wl1271_debug(DEBUG_EVENT, "EVENT on mbox %d", mbox_num);
>  
>         if (mbox_num > 1)
>                 return -EINVAL;
>  
> +       /* no GFP_ATOMIC: we're called from the threaded IRQ handler */
> +       mbox = kmalloc(sizeof(*mbox), GFP_DMA);
> +
>         /* first we read the mbox descriptor */
> -       wl1271_read(wl, wl->mbox_ptr[mbox_num], &mbox,
> -                   sizeof(struct event_mailbox), false);
> +       wl1271_read(wl, wl->mbox_ptr[mbox_num], mbox, sizeof(*mbox), false);
>  
>         /* process the descriptor */
> -       ret = wl1271_event_process(wl, &mbox);
> +       ret = wl1271_event_process(wl, mbox);
>         if (ret < 0)
> -               return ret;
> +               goto out;
>  
>         /* then we let the firmware know it can go on...*/
>         wl1271_write32(wl, ACX_REG_INTERRUPT_TRIG, INTR_TRIG_EVENT_ACK);
>  
> -       return 0;
> +out:
> +       kfree(mbox);
> +       return ret;
>  }

I think it would be better here to put another field into struct wl1271 to hold
the mailbox. There is no point allocating and freeing the field every time
you get into the interrupt handler.

	Arnd
--
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