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
F106135599: D5651.id14469.diff
Wed, Dec 25, 11:56 PM
F106135072: D5651.id14359.diff
Wed, Dec 25, 11:43 PM
F106134779: D5651.id14411.diff
Wed, Dec 25, 11:37 PM
F106105892: D5651.diff
Wed, Dec 25, 12:10 PM
Unknown Object (File)
Sat, Dec 14, 1:33 PM
Unknown Object (File)
Wed, Dec 11, 2:02 AM
Unknown Object (File)
Mon, Dec 2, 12:39 PM
Unknown Object (File)
Nov 5 2024, 6:06 AM

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.