This is in preparation for annotating copyin() and related functions
with __result_use_check.
Details
Details
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
Comment Actions
Hi Mark,
I'm sorry I missed this change over the holiday period, but wanted to flag that it introduced a bug by obscuring the EOVERFLOW case. I fixed this in the Netflix tree with a very simple patch:
--- a/FreeBSD/sys/kern/subr_stats.c +++ b/FreeBSD/sys/kern/subr_stats.c @@ -1078,9 +1078,9 @@ int stats_v1_blob_clone(struct statsblobv1 **dst, size_t dstmaxsz, struct statsblobv1 *src, uint32_t flags) { - int error; + int error, tmperror; - error = 0; + error = tmperror = 0; if (src == NULL || dst == NULL || src->cursz < sizeof(struct statsblob) || @@ -1131,14 +1131,16 @@ stats_v1_blob_clone(struct statsblobv1 **dst, size_t dstmaxsz, } #ifdef _KERNEL if (flags & SB_CLONE_USRDSTNOFAULT) - error = copyout_nofault(&(src->cursz), &((*dst)->cursz), + tmperror = copyout_nofault(&(src->cursz), &((*dst)->cursz), postcurszlen); else if (flags & SB_CLONE_USRDST) - error = copyout(&(src->cursz), &((*dst)->cursz), + tmperror = copyout(&(src->cursz), &((*dst)->cursz), postcurszlen); else #endif memcpy(&((*dst)->cursz), &(src->cursz), postcurszlen); + + error = error ? error : tmperror; } #ifdef _KERNEL out:
Unless you've got a different way you'd prefer to deal with the problem I'll post the patch to Phabricator soon.