Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: qed: reduce stack usage for TLV processing

clang gets a bit confused by the code in the qed_mfw_process_tlv_req and
ends up spilling registers to the stack hundreds of times. When sanitizers
are enabled, this can end up blowing the stack warning limit:

drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c:1244:5: error: stack frame size (1824) exceeds limit (1280) in 'qed_mfw_process_tlv_req' [-Werror,-Wframe-larger-than]

Apparently the problem is the complexity of qed_mfw_update_tlvs()
after inlining, and marking the four main branches of that function
as noinline_for_stack makes this problem completely go away, the stack
usage goes down to 100 bytes.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Reviewed-by: Alexander Lobakin <aleksander.lobakin@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Arnd Bergmann and committed by
David S. Miller
95b6759a b993ea46

+4 -4
+4 -4
drivers/net/ethernet/qlogic/qed/qed_mng_tlv.c
··· 242 242 } 243 243 244 244 /* Returns size of the data buffer or, -1 in case TLV data is not available. */ 245 - static int 245 + static noinline_for_stack int 246 246 qed_mfw_get_gen_tlv_value(struct qed_drv_tlv_hdr *p_tlv, 247 247 struct qed_mfw_tlv_generic *p_drv_buf, 248 248 struct qed_tlv_parsed_buf *p_buf) ··· 304 304 return -1; 305 305 } 306 306 307 - static int 307 + static noinline_for_stack int 308 308 qed_mfw_get_eth_tlv_value(struct qed_drv_tlv_hdr *p_tlv, 309 309 struct qed_mfw_tlv_eth *p_drv_buf, 310 310 struct qed_tlv_parsed_buf *p_buf) ··· 438 438 return QED_MFW_TLV_TIME_SIZE; 439 439 } 440 440 441 - static int 441 + static noinline_for_stack int 442 442 qed_mfw_get_fcoe_tlv_value(struct qed_drv_tlv_hdr *p_tlv, 443 443 struct qed_mfw_tlv_fcoe *p_drv_buf, 444 444 struct qed_tlv_parsed_buf *p_buf) ··· 1073 1073 return -1; 1074 1074 } 1075 1075 1076 - static int 1076 + static noinline_for_stack int 1077 1077 qed_mfw_get_iscsi_tlv_value(struct qed_drv_tlv_hdr *p_tlv, 1078 1078 struct qed_mfw_tlv_iscsi *p_drv_buf, 1079 1079 struct qed_tlv_parsed_buf *p_buf)