Re: [RFC][PATCH 2/8] breakout fdinfo sprintf() into its ownfunction

From: Dave Hansen
Date: Fri Feb 27 2009 - 16:23:45 EST


On Fri, 2009-02-27 at 21:56 +0100, Vegard Nossum wrote:
> > +static void proc_fd_write_info(struct file *file, char *info)
> > +{
> > + int max = PROC_FDINFO_MAX;
> > + int p = 0;
> > + if (!info)
> > + return;
> > +
> > + p += snprintf(info+p, max-p, "pos:\t%lli\n", (long long) file->f_pos);
> > + p += snprintf(info+p, max-p, "flags:\t0%o\n", file->f_flags);
>
> Actually, snprintf() is not the right function to use here.
> scnprintf(), perhaps?

Yes, that does look more appropriate. I'll double-check what happens
when we overrun the buffer.

-- Dave

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