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
Unknown Object (File)
Sat, Mar 23, 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
Unknown Object (File)
Dec 1 2023, 7:12 PM

Details

Summary

use the new function in vmbus driver and kvp driver

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 2931
Build 2959: arc lint + arc unit

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

Add "const" for "hv_guid *"

sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
305

add "const" for the guid pointer.

308

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

312

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

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.