NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-hpcmips/52446: src/sys/arch/hpcmips/stand/libsa/devopen.c poor error checking ?



>Number:         52446
>Category:       port-hpcmips
>Synopsis:       src/sys/arch/hpcmips/stand/libsa/devopen.c poor error checking ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    port-hpcmips-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 31 12:45:00 +0000 2017
>Originator:     David Binderman
>Release:        cvs-20170731
>Organization:
>Environment:
>Description:
src/sys/arch/hpcmips/stand/libsa/devopen.c:83]: (style) Checking if unsigned variable 'wcstombs(name,(TCHAR*)fname,sizeof(name))' is less than zero.

Source code is

       if (wcstombs(name, (TCHAR*)fname, sizeof(name)) < 0) {
            return (ENOENT);
        }


After a few seconds checking the man page for wcstombs, maybe the
following is better code

        if (wcstombs(name, (TCHAR*)fname, sizeof(name)) == (size_t) -1) {
            return (ENOENT);
        }


>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index