NetBSD-Bugs archive

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

kern/50571: src/sys/fs/udf/udf_subr.c:6465: obvious performance tidyup



>Number:         50571
>Category:       kern
>Synopsis:       src/sys/fs/udf/udf_subr.c:6465: obvious performance tidyup
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Dec 18 20:55:00 +0000 2015
>Originator:     David Binderman
>Release:        cvs dated 20151218
>Organization:
>Environment:
>Description:
[src/sys/fs/udf/udf_subr.c:6465] -> [src/sys/fs/udf/udf_subr.c:6466]: (performance) Buffer 'blob' is being written before its old content has been used.

Source code is

    assert(inflen < sector_size);

    /* copy out info */
    memset(blob, 0, sector_size);
    memcpy(blob, pos, inflen);

Maybe better code

    assert(inflen < sector_size);

    /* copy out info */
    memcpy(blob, pos, inflen);
    memset(&blob[inflen] 0, sector_size - inflen);

>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index