Listing 2. A Really Nasty Test Bug
case 2: // /dev/echo
return echoRead(Inode, userBuffer, bufSiz,
offset);
break;
case 3: // status
return statusRead(Inode, userBuffer, bufSiz,
offset);
break;
case 4:
// Should never get here. The open
// hangs.
return -EINVAL;
break;
case 5: // Okay, start overwriting everything
printk("About to go ka-boom!\n");
memset(NULL, 0,0xffffffff);
break;
} // switch
printk("%s: Error! Invalid minor device %d!\n",
GENTEST_MODULE_NAME, MINOR(Inode->i_rdev));
return (-EINVAL);
} // gRead
Copyright © 1994 - 2018 Linux Journal. All rights reserved.