lkml.org 
[lkml]   [2009]   [Mar]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: your mail


    On Wed, 11 Mar 2009, Vitaly Mayatskikh wrote:
    >
    > (v)scnprintf says it should return 0 when size is 0, but doesn't do
    > so. Also size_t is unsigned, it can't be less then 0. Fix the code and
    > comments.

    That is bogus.

    The code really does (od "did"? Maybe you removed it) check for _smaller_
    than 0:

    int vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
    {
    ...
    /* Reject out-of-range values early. Large positive sizes are
    used for unknown buffer sizes. */
    if (unlikely((int) size < 0)) {
    /* There can be only one.. */
    static char warn = 1;
    WARN_ON(warn);
    warn = 0;
    return 0;
    }
    ...

    because under/overflows have happened.

    The kernel is _not_ a regular libc. We have different rules.

    Linus


    \
     
     \ /
      Last update: 2009-03-11 16:07    [W:0.019 / U:29.812 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site