public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* arch/arm64/kernel/proton-pack.c:302:5: warning: Redundant assignment of 'cb' to itself. [selfAssignment]
@ 2022-05-07  9:57 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-05-07  9:57 UTC (permalink / raw)
  To: Will Deacon; +Cc: kbuild-all, linux-kernel

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   4b97bac0756a81cda5afd45417a99b5bccdcff67
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 as appropriate
Reported-by: kernel test robot <lkp@intel.com>


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;
       ^

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* arch/arm64/kernel/proton-pack.c:302:5: warning: Redundant assignment of 'cb' to itself. [selfAssignment]
@ 2022-06-02 19:50 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2022-06-02 19:50 UTC (permalink / raw)
  To: Will Deacon; +Cc: kbuild-all, linux-kernel

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@intel.com>


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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-06-02 19:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-07  9:57 arch/arm64/kernel/proton-pack.c:302:5: warning: Redundant assignment of 'cb' to itself. [selfAssignment] kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2022-06-02 19:50 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox