arch/arm64/kernel/proton-pack.c:302:5: warning: Redundant assignment of 'cb' to itself. [selfAssignment]
From: kernel test robot
Date: Thu Jun 02 2022 - 15:51:02 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 17d8e3d90b6989419806c1926b894d7d7483a25b
commit: ea8f8c99a28199f6e067581b8626d192b07750f2 arm64: spectre-v2: Favour CPU-specific mitigation at EL2
date: 1 year, 7 months ago
compiler: aarch64-linux-gcc (GCC) 11.3.0
reproduce (cppcheck warning):
# apt-get install cppcheck
git checkout ea8f8c99a28199f6e067581b8626d192b07750f2
cppcheck --quiet --enable=style,performance,portability --template=gcc FILE
If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>
cppcheck warnings: (new ones prefixed by >>)
>> arch/arm64/kernel/proton-pack.c:302:5: warning: Redundant assignment of 'cb' to itself. [selfAssignment]
cb = spectre_v2_get_sw_mitigation_cb() ?: cb;
^
cppcheck possible warnings: (new ones prefixed by >>, may not real problems)
>> arch/arm64/mm/hugetlbpage.c:104:14: warning: Parameter 'ptep' can be declared with const [constParameter]
pte_t *ptep, size_t *pgsize)
^
--
>> arch/arm64/mm/mmu.c:558:74: warning: Parameter 'va_end' can be declared with const [constParameter]
static void __init map_kernel_segment(pgd_t *pgdp, void *va_start, void *va_end,
^
>> arch/arm64/mm/mmu.c:1441:41: warning: Parameter 'pgdir' can be declared with const [constParameter]
static void __remove_pgd_mapping(pgd_t *pgdir, unsigned long start, u64 size)
^
vim +/cb +302 arch/arm64/kernel/proton-pack.c
272
273 static enum mitigation_state spectre_v2_enable_fw_mitigation(void)
274 {
275 bp_hardening_cb_t cb;
276 enum mitigation_state state;
277
278 state = spectre_v2_get_cpu_fw_mitigation_state();
279 if (state != SPECTRE_MITIGATED)
280 return state;
281
282 if (spectre_v2_mitigations_off())
283 return SPECTRE_VULNERABLE;
284
285 switch (arm_smccc_1_1_get_conduit()) {
286 case SMCCC_CONDUIT_HVC:
287 cb = call_hvc_arch_workaround_1;
288 break;
289
290 case SMCCC_CONDUIT_SMC:
291 cb = call_smc_arch_workaround_1;
292 break;
293
294 default:
295 return SPECTRE_VULNERABLE;
296 }
297
298 /*
299 * Prefer a CPU-specific workaround if it exists. Note that we
300 * still rely on firmware for the mitigation at EL2.
301 */
> 302 cb = spectre_v2_get_sw_mitigation_cb() ?: cb;
303 install_bp_hardening_cb(cb);
304 return SPECTRE_MITIGATED;
305 }
306
--
0-DAY CI Kernel Test Service
https://01.org/lkp