From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: akpm@osdl.org, linux-kernel@vger.kernel.org
Subject: [PATCH] isicom: Fix buffer allocation
Date: Tue, 29 Apr 2008 14:17:33 +0100 [thread overview]
Message-ID: <20080429141733.607a2306@core> (raw)
Fix the rather strange buffer management on open that turned up while
auditing for BKL dependancies
Signed-off-by: Alan Cox <alan@redhat.com>
diff -u --new-file --recursive --exclude-from /usr/src/exclude linux.vanilla-2.6.25-mm1/drivers/char/isicom.c linux-2.6.25-mm1/drivers/char/isicom.c
--- linux.vanilla-2.6.25-mm1/drivers/char/isicom.c 2008-04-28 11:36:48.000000000 +0100
+++ linux-2.6.25-mm1/drivers/char/isicom.c 2008-04-14 10:56:25.000000000 +0100
@@ -813,15 +813,13 @@
return 0;
if (!port->xmit_buf) {
/* Relies on BKL */
- void *xmit_buf = (void *)get_zeroed_page(GFP_KERNEL);
-
- if (xmit_buf == NULL)
+ unsigned long page = get_zeroed_page(GFP_KERNEL);
+ if (page == 0)
return -ENOMEM;
- if (port->xmit_buf) {
- free_page((unsigned long)xmit_buf);
- return -ERESTARTSYS;
- }
- port->xmit_buf = xmit_buf;
+ if (port->xmit_buf)
+ free_page(page);
+ else
+ port->xmit_buf = (unsigned char *) page;
}
spin_lock_irqsave(&card->card_lock, flags);
next reply other threads:[~2008-04-29 13:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-29 13:17 Alan Cox [this message]
2008-04-29 15:26 ` [PATCH] isicom: Fix buffer allocation Olivier Galibert
2008-04-29 15:59 ` Alan Cox
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=20080429141733.607a2306@core \
--to=alan@lxorguk.ukuu.org.uk \
--cc=akpm@osdl.org \
--cc=linux-kernel@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.