Re: [PATCH] ramoops: Add a device file for ramoops buffer access.

From: Alan Cox
Date: Mon Nov 07 2011 - 19:14:06 EST



> +static int ramoops_open(struct inode *inode, struct file *file)
> +{
> + file->private_data = &oops_cxt;

Well I guess you'll only have one..

> + if (copy_to_user(buf, from, count))
> + count = -EFAULT;
> + else
> + *ppos += count;

Mindnumbingly pedantically you should return -EFAULT only if none of the
bytes copied, otherwise the partial length. Do we actually care in a case
like this - not really.

Looks good to me and we really want to get away from using /dev/mem for
stuff. Ideally to a world where /dev/mem can be compiled out of any
normal system completely so

Acked-by: Alan Cox <alan@xxxxxxxxxxxxxxx>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/