NetBSD-Bugs archive

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

kern/50899: src/sys/netinet/sctputil.c:857: sloppy call to memset ?



>Number:         50899
>Category:       kern
>Synopsis:       src/sys/netinet/sctputil.c:857: sloppy 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:35:00 +0000 2016
>Originator:     David Binderman
>Release:        cvs dated 20160305
>Organization:
>Environment:
>Description:
[src/sys/netinet/sctputil.c:857] -> [src/sys/netinet/sctputil.c:858]: (performance) Buffer 'new_array' is being written before its old content has been used.

    memset(new_array, 0, new_size);
    memcpy(new_array, asoc->mapping_array, asoc->mapping_array_size);

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