Source-Changes archive

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

CVS commit: src/sys/dev/usb



Module Name:    src
Committed By:   mrg
Date:           Fri Oct 23 05:07:17 UTC 2026

Modified Files:
        src/sys/dev/usb: ohci.c

Log Message:
revert ohci 1.330:

---
use PR_ZERO on on pool allcoated memory and get rid of memset.

currently, xfer is zeroed using the wrong size.
remove it and simplify code.

reviewed by christos@
---

Taylor pointed out that pool_cache*() does not document or honour
PR_ZERO, so this actually no longer is returning zeroed ohci_xfer
structures.  it also did not have the "wrong size", but that is an
understandable mistake -- the cost assignes to "struct usb_xfer *",
but is really a "struct ohci_xfer", which is usb_xfer + more, so
while it appears to be memset()ing beyond the buffer, it isn't.

wrt pool_cache and PR_ZERO, there's a strange conflict between the
pool_cache design and PR_ZERO itself.  pool_cache provides two
features beyond normal pool:  ctor/dtor routines that are applied
once per backing allocation (ie, not when pool_cache_get() returns),
with the idea that some reusable portion of the object is retained
across normal alloc/free (such as an embedded lock.)  however,
pool_cache also introduces the per-cpu cache layer, and it is
normal to use pool_cache with no ctor/dtor, which would means that
PR_ZERO could be useful, but right now it doesn't.

XXX: maybe assert or at least fail pool_cache_get() with the wrong
flags, such as this one.


To generate a diff of this commit:
cvs rdiff -u -r1.332 -r1.333 src/sys/dev/usb/ohci.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.




Home | Main Index | Thread Index | Old Index