Page MenuHomeFreeBSD

Xen blkfront: Fixed wrong error code return in xbd_dump()
ClosedPublic

Authored by pratyush on Jun 28 2018, 11:56 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 3:53 PM
Unknown Object (File)
Mar 27 2024, 7:33 AM
Unknown Object (File)
Mar 27 2024, 12:02 AM
Unknown Object (File)
Mar 7 2024, 11:38 PM
Unknown Object (File)
Feb 15 2024, 10:24 AM
Unknown Object (File)
Jan 26 2024, 3:46 PM
Unknown Object (File)
Jan 26 2024, 3:46 PM
Unknown Object (File)
Jan 26 2024, 3:42 PM
Subscribers

Details

Reviewers
royger
trasz
Summary

rc is initialized to 0. Returning 0 here would indicate success.

Return EINVAL instead to indicate the error.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

sys/dev/xen/blkfront/blkfront.c
605

length is of type size_t, which is an unsigned type, so checking it against < 0 is useless. Also if length == 0 you should just return 0.

C
if ( length == 0)
    return 0;

Is IMO the correct fix. Although the code is already functionally correct because it returns 0 when length == 0, which is fine.

I updated the diff. Your call if you want to commit the change or leave it as it is.

This revision is now accepted and ready to land.Jul 30 2018, 10:48 AM