[kernel] bug#118: strncpy_from_user broken


None


X-PA-RISC Linux-PR-Message: report 118
X-PA-RISC Linux-PR-Package: kernel
X-Loop: daniel_frazier@hp.com
Received: via spool by bugs@bugs.parisc-linux.org id=B.98902879810482
          (code B ref -1); Sat, 05 May 2001 02:18:01 GMT
Date: Fri, 4 May 2001 20:13:17 -0600
To: submit@bugs.parisc-linux.org
Message-ID: <20010504201317.J6063@zumpano.fc.hp.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.2.5i
From: willy@ldl.fc.hp.com (Matthew Wilcox)


Package: kernel

strncpy_from_user is specified to return number of characters copied,
not including the terminating NUL.  This conflicts with the comment we
have in our version and with what code assumes elsewhere in the kernel.
eg fs/namei.c:

        retval = strncpy_from_user((char *)page, filename, len);
        if (retval > 0) {
                if (retval < len)
                        return 0;
                return -ENAMETOOLONG;
        } else if (!retval)
                retval = -ENOENT;
        return retval;

and an strace of one of the failing glibc tests:

chmod("", 0600)                         = 0

so both the comment and the code need fixing.


----- End forwarded message -----