From a52545afeda06441841f6143d8fd563251549acb Mon Sep 17 00:00:00 2001 From: Jian Yu Date: Thu, 17 Aug 2023 13:46:38 -0700 Subject: [PATCH] LU-16510 build: check if CONFIG_FORTIFY_SOURCE is defined The linux/fortify-string.h header file should not be included while the kernel config option CONFIG_FORTIFY_SOURCE is not defined. Change-Id: I2e1905406e892b182f143d512a2d3722b141e52d Fixes: 919b93b951d4 ("LU-16510 build: fortified memcpy from linux 6.1") Signed-off-by: Jian Yu Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/51973 Reviewed-by: Patrick Farrell Reviewed-by: Shaun Tancheff Reviewed-by: Oleg Drokin Tested-by: jenkins Tested-by: Maloo --- libcfs/include/libcfs/linux/linux-fortify-string.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libcfs/include/libcfs/linux/linux-fortify-string.h b/libcfs/include/libcfs/linux/linux-fortify-string.h index b00d9f7..b8ec03e 100644 --- a/libcfs/include/libcfs/linux/linux-fortify-string.h +++ b/libcfs/include/libcfs/linux/linux-fortify-string.h @@ -1,7 +1,9 @@ #ifndef _LIBCFS_FORTIFY_STRING_H #define _LIBCFS_FORTIFY_STRING_H -#ifdef HAVE_LINUX_FORTIFY_STRING_HEADER +#if defined(HAVE_LINUX_FORTIFY_STRING_HEADER) && \ + !defined(__NO_FORTIFY) && defined(__OPTIMIZE__) && \ + defined(CONFIG_FORTIFY_SOURCE) #include /* -- 1.8.3.1