- 论坛徽章:
- 0
|
今天看ldd2看到printk中的格式字符串中有一个是%p,不知道是什么意思,请教大家了!
ssize_t faulty_read (struct file *filp, char *buf, size_t count, loff_t *pos)
{
int ret, ret2;
char stack_buf[4];
printk(KERN_DEBUG "read: buf %p, count %li\n", buf, (long)count);
/* the next line oopses with 2.0, but not with 2.2 and later */
ret = copy_to_user(buf, faulty_buf, count);
if (!ret) return count; /* we survived */
printk(KERN_DEBUG "didn't fail: retry\n" ;
/* For 2.2 and 2.4, let's try a buffer overflow */
sprintf(stack_buf, "1234567\n" ;
if (count > count = 8; /* copy 8 bytes to the user */
ret2 = copy_to_user(buf, stack_buf, count);
if (!ret2) return count;
return ret2;
} |
|