[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50C1415C.2060104@asianux.com>
Date: Fri, 07 Dec 2012 09:07:40 +0800
From: Chen Gang <gang.chen@...anux.com>
To: chas williams - CONTRACTOR <chas@....nrl.navy.mil>
CC: David Miller <davem@...emloft.net>, netdev <netdev@...r.kernel.org>
Subject: Re: [Suggestion] net/atm : for sprintf, need check the total write
length whether larger than a page.
于 2012年12月06日 22:08, chas williams - CONTRACTOR 写道:
> On Thu, 06 Dec 2012 09:15:10 +0800
> Chen Gang <gang.chen@...anux.com> wrote:
>
>> 于 2012年12月05日 22:55, chas williams - CONTRACTOR 写道:
>
>>> did you mean '\0' instead of '\n'? scnprintf() considers the trailing
>>> '\0' when formatting.
>>
>> no, originally, the end is "\n\0".
>>
>> I prefer we still compatible "\n" when the contents are very large.
>> if count already == (PAGE_SIZE - 1), we have no chance to append "\n" to the end.
>>
>> - pos += sprintf(pos, "\n");
>> + count += scnprintf(buf + count, PAGE_SIZE - count, "\n");
>
> i would make the code a bit messy to do this for not much gain. again,
> it isnt likely you would run into this in a normal situation.
surely.
thanks.
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
--
Chen Gang
Asianux Corporation
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists