[Bug 285802] Fix MPASS(sa_len <= MLEN) compilation error with large MSIZE
Date: Mon, 31 Mar 2025 09:37:13 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=285802 Bug ID: 285802 Summary: Fix MPASS(sa_len <= MLEN) compilation error with large MSIZE Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: nakayamakenjiro@gmail.com Created attachment 259208 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=259208&action=edit A patch to fix MPASS(sa_len <= MLEN) compilation error with large MSIZE In sys/kern/uipc_usrreq.c, there is an MPASS validation: ``` MPASS(from->sa_len <= MLEN); ``` However, if MSIZE is set to a larger value (e.g. 512), MLEN exceeds 255 — the maximum value of an unsigned char — and the code fails to compile with strict warnings enabled: ``` error: result of comparison of constant 480 with expression of type 'const unsigned char' is always true [-Werror,-Wtautological-constant-out-of-range-compare] 1241 | MPASS(from->sa_len <= MLEN); ``` In another part of the code, a similar check is guarded by a conditional, so this validation should probably follow the same pattern. In freebsd/sys/kern/uipc_sockbuf.c: ``` #if MSIZE <= 256 if (asa->sa_len > MLEN) return (0); #endif ``` -- You are receiving this mail because: You are the assignee for the bug.