Re: [patch 6/6] s390: qeth network driver.

From: Alan Cox
Date: Tue Nov 30 2004 - 14:02:33 EST


On Maw, 2004-11-30 at 17:48, Jeff Garzik wrote:
> > + /* String must not be longer than PAGE_SIZE. So we check for
> > + * length >= 3900 here. Then we can savely display the next
> > + * IPv6 address and our info message below */
> > + if (i >= 3900) {
> > + i += sprintf(buf + i,
> > + "... Too many entries to be displayed. "
> > + "Skipping remaining entries.\n");
> > + break;
> > + }
>
>
> ACK, although I dislike the open-coding of the magic number 3900.

Use snprintf and the problem goes away I think

static char *errorstring = "... "

errorlen = strlen(errorstring);

If(i < PAGE_SIZE - errorlen)
i += snprintf(buf + i, PAGE_SIZE - i, ...)
else {
memcpy(buf+i, errorstring, errorlen);
i += errorlen;
break;
}
-
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/