Re: Message while writing to /dev/lp0 in 2.1.41

Tim Waugh (tmw20@cam.ac.uk)
Fri, 30 May 1997 01:55:59 +0100 (BST)


On Thu, 29 May 1997 tenthumbs@cybernex.net wrote:

> If I say "cat foo.txt >/dev/lp0" I get the message "kfree_s: Bad obj 00000000"
> from the kernel. This is a 2.1.41 kernel with lp and parport built as modules.
> This doesn't seem to cause any problems, however.

Yes, this needs to go into 2.1.42 (but it isn't in the pre-patch):

--- linux/drivers/char/lp.c~ Thu May 29 01:08:48 1997
+++ linux/drivers/char/lp.c Thu May 29 01:08:49 1997
@@ -501,9 +501,8 @@
static int lp_release(struct inode * inode, struct file * file)
{
unsigned int minor = MINOR(inode->i_rdev);
- unsigned int irq;

- if ((irq = LP_IRQ(minor))) {
+ if (LP_IRQ(minor) > 0) {
kfree_s(lp_table[minor].lp_buffer, LP_BUFFER_SIZE);
lp_table[minor].lp_buffer = NULL;
}
@@ -707,7 +706,7 @@
lp_table[count].flags |= LP_EXIST;
printk(KERN_INFO "lp%d: using %s at 0x%x, ",
count, pb->name, pb->base);
- if (pb->irq == -1)
+ if (pb->irq == PARPORT_IRQ_NONE)
printk("polling.\n");
else
printk("irq %d.\n", pb->irq);