NetBSD-Bugs archive

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

kern/50900: src/sys/rump/librump/rumpvfs/rumpfs.c:936: clumsy call to memset ?



>Number:         50900
>Category:       kern
>Synopsis:       src/sys/rump/librump/rumpvfs/rumpfs.c:936: clumsy call to memset ?
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 06 17:50:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160305
>Organization:
>Environment:
>Description:
[src/sys/rump/librump/rumpvfs/rumpfs.c:936] -> [src/sys/rump/librump/rumpvfs/rumpfs.c:937]: (performance) Buffer 'newdata' is being written before its old content has been used.

Source code is

        copylen = MIN(rn->rn_dlen, newlen);
        memset(newdata, 0, newlen);
        memcpy(newdata, rn->rn_data, copylen);

This could be coded up in a faster fashion, 

Suggest only zero those bytes that the memcpy doesn't touch.


>How-To-Repeat:

>Fix:



Home | Main Index | Thread Index | Old Index