git: b8730c11a395 - main - include: ssp: fix the build with earlier C standards
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 16 Jul 2024 05:12:46 UTC
The branch main has been updated by kevans:
URL: https://cgit.FreeBSD.org/src/commit/?id=b8730c11a395dacc089311ead1c9e015682a1ccb
commit b8730c11a395dacc089311ead1c9e015682a1ccb
Author: Kyle Evans <kevans@FreeBSD.org>
AuthorDate: 2024-07-16 05:12:27 +0000
Commit: Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2024-07-16 05:12:27 +0000
include: ssp: fix the build with earlier C standards
`inline` isn't always a keyword, so we should be using __ssp_inline
as we do everywhere else in the _FORTIFY_SOURCE support. Variable
declarations in a loop initializer are also not always supported, so
declare any loop vars in advance.
Reviewed by: kib (earlier version), markj
Sponsored by: Klara, Inc.
Sponsored by: Stormshield
Differential Revision: https://reviews.freebsd.org/D45976
---
include/ssp/socket.h | 3 ++-
include/ssp/ssp.h | 5 +++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/include/ssp/socket.h b/include/ssp/socket.h
index 6c0051ad72dc..30a8f0adf1ea 100644
--- a/include/ssp/socket.h
+++ b/include/ssp/socket.h
@@ -101,11 +101,12 @@ __ssp_redirect_raw_impl(ssize_t, recvmmsg, recvmmsg,
const struct timespec *__restrict timeout))
{
const size_t vecsz = __ssp_bos(hdrvec);
+ size_t i;
if (vecsz != (size_t)-1 && vecsz / sizeof(*hdrvec) < vlen)
__chk_fail();
- for (size_t i = 0; i < vlen; i++) {
+ for (i = 0; i < vlen; i++) {
__ssp_check_msghdr(&hdrvec[i].msg_hdr);
}
diff --git a/include/ssp/ssp.h b/include/ssp/ssp.h
index bdc14137d45b..a161df31d3d4 100644
--- a/include/ssp/ssp.h
+++ b/include/ssp/ssp.h
@@ -89,7 +89,7 @@ __ssp_redirect_raw_impl(rtype, fun, symbol, args) { \
#include <machine/_stdint.h>
-static inline int
+__ssp_inline int
__ssp_overlap(const void *leftp, const void *rightp, __size_t sz)
{
__uintptr_t left = (__uintptr_t)leftp;
@@ -112,11 +112,12 @@ __ssp_inline void
__ssp_check_iovec(const struct iovec *iov, int iovcnt)
{
const size_t iovsz = __ssp_bos(iov);
+ int i;
if (iovsz != (size_t)-1 && iovsz / sizeof(*iov) < (size_t)iovcnt)
__chk_fail();
- for (int i = 0; i < iovcnt; i++) {
+ for (i = 0; i < iovcnt; i++) {
if (__ssp_bos(iov[i].iov_base) < iov[i].iov_len)
__chk_fail();
}