Skip to content

Commit d5352b4

Browse files
Pei XiaoMiriam-Rachel
authored andcommitted
wifi: iwlwifi: cfg: Limit cb_size to valid range
on arm64 defconfig build failed with gcc-8: drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c:208:3: include/linux/bitfield.h:195:3: error: call to '__field_overflow' declared with attribute error: value doesn't fit into mask __field_overflow(); \ ^~~~~~~~~~~~~~~~~~ include/linux/bitfield.h:215:2: note: in expansion of macro '____MAKE_OP' ____MAKE_OP(u##size,u##size,,) ^~~~~~~~~~~ include/linux/bitfield.h:218:1: note: in expansion of macro '__MAKE_OP' __MAKE_OP(32) Limit cb_size to valid range to fix it. Signed-off-by: Pei Xiao <[email protected]> Link: https://patch.msgid.link/7b373a4426070d50b5afb3269fd116c18ce3aea8.1748332709.git.xiaopei01@kylinos.cn Signed-off-by: Miri Korenblit <[email protected]>
1 parent db5957a commit d5352b4

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

drivers/net/wireless/intel/iwlwifi/pcie/ctxt-info.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
166166
struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
167167
struct iwl_context_info *ctxt_info;
168168
struct iwl_context_info_rbd_cfg *rx_cfg;
169-
u32 control_flags = 0, rb_size;
169+
u32 control_flags = 0, rb_size, cb_size;
170170
dma_addr_t phys;
171171
int ret;
172172

@@ -202,11 +202,12 @@ int iwl_pcie_ctxt_info_init(struct iwl_trans *trans,
202202
rb_size = IWL_CTXT_INFO_RB_SIZE_4K;
203203
}
204204

205-
WARN_ON(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)) > 12);
205+
cb_size = RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans));
206+
if (WARN_ON(cb_size > 12))
207+
cb_size = 12;
208+
206209
control_flags = IWL_CTXT_INFO_TFD_FORMAT_LONG;
207-
control_flags |=
208-
u32_encode_bits(RX_QUEUE_CB_SIZE(iwl_trans_get_num_rbds(trans)),
209-
IWL_CTXT_INFO_RB_CB_SIZE);
210+
control_flags |= u32_encode_bits(cb_size, IWL_CTXT_INFO_RB_CB_SIZE);
210211
control_flags |= u32_encode_bits(rb_size, IWL_CTXT_INFO_RB_SIZE);
211212
ctxt_info->control.control_flags = cpu_to_le32(control_flags);
212213

0 commit comments

Comments
 (0)