Page MenuHomeFreeBSD

hyperv/vmbus: introduce snprinf_hv_guid
ClosedPublic

Authored by howard0su_gmail.com on Mar 16 2016, 2:54 PM.
Tags
None
Referenced Files
F81969264: D5651.diff
Sat, Dec 14, 4:30 AM
Unknown Object (File)
Mar 23 2024, 1:27 AM
Unknown Object (File)
Feb 19 2024, 8:03 PM
Unknown Object (File)
Feb 6 2024, 8:20 AM
Unknown Object (File)
Jan 16 2024, 6:03 PM
Unknown Object (File)
Dec 14 2023, 10:48 PM
Unknown Object (File)
Dec 3 2023, 9:47 PM
Unknown Object (File)
Dec 2 2023, 9:54 PM

Details

Summary

use the new function in vmbus driver and kvp driver

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

howard0su_gmail.com retitled this revision from to hyperv/vmbus: introduce snprinf_hv_guid.
howard0su_gmail.com updated this object.
howard0su_gmail.com edited the test plan for this revision. (Show Details)
decui_microsoft.com added inline comments.
sys/dev/hyperv/include/hyperv.h
127 ↗(On Diff #14359)

Add "const" for "hv_guid *"

sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
305 ↗(On Diff #14359)

add "const" for the guid pointer.

308 ↗(On Diff #14359)

add "const unsigned" for d.
Note: unsigned is a must here, or *d can signed-expand to 0xFFFFFFxx and cause a trimmed string...

312 ↗(On Diff #14359)

It should be
d[3], d[2], d[1], d[0], d[5], d[4], d[7], d[6],

See https://en.wikipedia.org/wiki/Globally_unique_identifier (the first 4+2+2 bytes are in little endian on x86)

314 ↗(On Diff #14359)

before "return", add

KASSERT(cnt < sz, ("snprintf_hv_guid: too small buf: cnt=%d!\n", cnt));

Add const and KASSERT too?
Just to make sure people can't pass a too small buf size by mistake (the exact buf size needed here is 37).

Add const and KASSERT too?

I didn't see your comments before I made the change. I added const.

Just to make sure people can't pass a too small buf size by mistake (the exact buf size needed here is 37).

I don't agree on this since snprintf in general should not panic if buf is not enough. this function should inherit that behavior.

howard0su_gmail.com marked an inline comment as done.

address review feedback

decui_microsoft.com edited edge metadata.

I'm Ok without the KASSERT.

LGTM

This revision is now accepted and ready to land.Mar 18 2016, 3:18 AM
This revision was automatically updated to reflect the committed changes.