Re: [PATCH v2 2/2] proc: do not allow negative offsets on/proc/<pid>/environ

From: Oleg Nesterov
Date: Wed Jul 25 2012 - 08:20:00 EST


On 07/24, Djalal Harouni wrote:
>
> static int mem_open(struct inode *inode, struct file *file)
> {
> - return __mem_open(inode, file, PTRACE_MODE_ATTACH);
> + int ret = __mem_open(inode, file, PTRACE_MODE_ATTACH);
> +
> + /* OK to pass negative loff_t, we can catch out-of-range */
> + file->f_mode |= FMODE_UNSIGNED_OFFSET;
> +
> + return ret;
> }

It could be even simpler, I meant

file->f_mode |= FMODE_UNSIGNED_OFFSET;
return __mem_open(inode, file, PTRACE_MODE_ATTACH);

Never mind, this is very minor and the patch is already in -mm.

Oleg.

--
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/