2023-11-28 06:23:25

by Dan Carpenter

[permalink] [raw]
Subject: arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
commit: fad84e39f116035ae8d550c6020107b8ac113b45 ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA
config: arc-randconfig-r071-20231128 (https://download.01.org/0day-ci/archive/20231128/[email protected]/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231128/[email protected]/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Reported-by: Dan Carpenter <[email protected]>
| Closes: https://lore.kernel.org/r/[email protected]/

New smatch warnings:
arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

Old smatch warnings:
arch/arc/include/asm/thread_info.h:62 current_thread_info() error: uninitialized symbol 'sp'.

vim +/release +203 arch/arc/kernel/setup.c

fad84e39f11603 Vineet Gupta 2020-06-11 150 static int arcv2_mumbojumbo(int c, struct cpuinfo_arc *info, char *buf, int len)
fad84e39f11603 Vineet Gupta 2020-06-11 151 {
fad84e39f11603 Vineet Gupta 2020-06-11 152 int n = 0;
fad84e39f11603 Vineet Gupta 2020-06-11 153 #ifdef CONFIG_ISA_ARCV2
fad84e39f11603 Vineet Gupta 2020-06-11 154 const char *release, *cpu_nm, *isa_nm = "ARCv2";
fad84e39f11603 Vineet Gupta 2020-06-11 155 int dual_issue = 0, dual_enb = 0, mpy_opt, present;
fad84e39f11603 Vineet Gupta 2020-06-11 156 int bpu_full, bpu_cache, bpu_pred, bpu_ret_stk;
fad84e39f11603 Vineet Gupta 2020-06-11 157 char mpy_nm[16], lpb_nm[32];
fad84e39f11603 Vineet Gupta 2020-06-11 158 struct bcr_isa_arcv2 isa;
fad84e39f11603 Vineet Gupta 2020-06-11 159 struct bcr_mpy mpy;
fad84e39f11603 Vineet Gupta 2020-06-11 160 struct bcr_fp_arcv2 fpu;
fad84e39f11603 Vineet Gupta 2020-06-11 161 struct bcr_bpu_arcv2 bpu;
fad84e39f11603 Vineet Gupta 2020-06-11 162 struct bcr_lpb lpb;
fad84e39f11603 Vineet Gupta 2020-06-11 163 struct bcr_iccm_arcv2 iccm;
fad84e39f11603 Vineet Gupta 2020-06-11 164 struct bcr_dccm_arcv2 dccm;
fad84e39f11603 Vineet Gupta 2020-06-11 165 struct bcr_erp erp;
00a4ae65cc600b Vineet Gupta 2019-02-25 166
00a4ae65cc600b Vineet Gupta 2019-02-25 167 /*
97d0b5d0b5a998 Vineet Gupta 2020-06-10 168 * Initial HS cores bumped AUX IDENTITY.ARCVER for each release until
97d0b5d0b5a998 Vineet Gupta 2020-06-10 169 * ARCVER 0x54 which introduced AUX MICRO_ARCH_BUILD and subsequent
97d0b5d0b5a998 Vineet Gupta 2020-06-10 170 * releases only update it.
00a4ae65cc600b Vineet Gupta 2019-02-25 171 */
00a4ae65cc600b Vineet Gupta 2019-02-25 172
fad84e39f11603 Vineet Gupta 2020-06-11 173 cpu_nm = "HS38";
00a4ae65cc600b Vineet Gupta 2019-02-25 174
fad84e39f11603 Vineet Gupta 2020-06-11 175 if (info->arcver > 0x50 && info->arcver <= 0x53) {
fad84e39f11603 Vineet Gupta 2020-06-11 176 release = arc_hs_rel[info->arcver - 0x51].str;
00a4ae65cc600b Vineet Gupta 2019-02-25 177 } else {
fad84e39f11603 Vineet Gupta 2020-06-11 178 const struct id_to_str *tbl;
fad84e39f11603 Vineet Gupta 2020-06-11 179 struct bcr_uarch_build uarch;
fad84e39f11603 Vineet Gupta 2020-06-11 180
fad84e39f11603 Vineet Gupta 2020-06-11 181 READ_BCR(ARC_REG_MICRO_ARCH_BCR, uarch);
00a4ae65cc600b Vineet Gupta 2019-02-25 182
97d0b5d0b5a998 Vineet Gupta 2020-06-10 183 for (tbl = &arc_hs_ver54_rel[0]; tbl->id != 0xFF; tbl++) {
00a4ae65cc600b Vineet Gupta 2019-02-25 184 if (uarch.maj == tbl->id) {
fad84e39f11603 Vineet Gupta 2020-06-11 185 release = tbl->str;

Will we always hit this assignment?

d975cbc8acb6f4 Vineet Gupta 2016-10-27 186 break;
d975cbc8acb6f4 Vineet Gupta 2016-10-27 187 }
00a4ae65cc600b Vineet Gupta 2019-02-25 188 }
fad84e39f11603 Vineet Gupta 2020-06-11 189 if (uarch.prod == 4) {
fad84e39f11603 Vineet Gupta 2020-06-11 190 unsigned int exec_ctrl;
00a4ae65cc600b Vineet Gupta 2019-02-25 191
fad84e39f11603 Vineet Gupta 2020-06-11 192 cpu_nm = "HS48";
fad84e39f11603 Vineet Gupta 2020-06-11 193 dual_issue = 1;
fad84e39f11603 Vineet Gupta 2020-06-11 194 /* if dual issue hardware, is it enabled ? */
fad84e39f11603 Vineet Gupta 2020-06-11 195 READ_BCR(AUX_EXEC_CTRL, exec_ctrl);
fad84e39f11603 Vineet Gupta 2020-06-11 196 dual_enb = !(exec_ctrl & 1);
fad84e39f11603 Vineet Gupta 2020-06-11 197 }
fad84e39f11603 Vineet Gupta 2020-06-11 198 }
73e284d2572581 Vineet Gupta 2016-10-20 199
fad84e39f11603 Vineet Gupta 2020-06-11 200 READ_BCR(ARC_REG_ISA_CFG_BCR, isa);
b89bd1f4fbaeca Vineet Gupta 2016-01-22 201
fad84e39f11603 Vineet Gupta 2020-06-11 202 n += scnprintf(buf + n, len - n, "processor [%d]\t: %s %s (%s ISA) %s%s%s\n",
fad84e39f11603 Vineet Gupta 2020-06-11 @203 c, cpu_nm, release, isa_nm,
fad84e39f11603 Vineet Gupta 2020-06-11 204 IS_AVAIL1(isa.be, "[Big-Endian]"),
fad84e39f11603 Vineet Gupta 2020-06-11 205 IS_AVAIL3(dual_issue, dual_enb, " Dual-Issue "));
af61742813aa9d Vineet Gupta 2013-01-18 206

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


2023-12-09 00:33:57

by Vineet Gupta

[permalink] [raw]
Subject: Re: arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

On 11/27/23 22:22, Dan Carpenter wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
> commit: fad84e39f116035ae8d550c6020107b8ac113b45 ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA
> config: arc-randconfig-r071-20231128 (https://download.01.org/0day-ci/archive/20231128/[email protected]/config)
> compiler: arceb-elf-gcc (GCC) 13.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20231128/[email protected]/reproduce)
>
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <[email protected]>
> | Reported-by: Dan Carpenter <[email protected]>
> | Closes: https://lore.kernel.org/r/[email protected]/
>
> New smatch warnings:
> arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

Thx, I've posted a fix.

> Old smatch warnings:
> arch/arc/include/asm/thread_info.h:62 current_thread_info() error: uninitialized symbol 'sp'.

This seems like a false warning. Its a register variable and thus can't
possibly be initialized.

static inline __attribute_const__ struct thread_info
*current_thread_info(void)
{
    register unsigned long sp asm("sp");
    return (struct thread_info *)(sp & ~(THREAD_SIZE - 1));
}

2023-12-09 06:59:53

by Dan Carpenter

[permalink] [raw]
Subject: Re: arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.

On Fri, Dec 08, 2023 at 04:33:44PM -0800, Vineet Gupta wrote:
> On 11/27/23 22:22, Dan Carpenter wrote:
> > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> > head: 2cc14f52aeb78ce3f29677c2de1f06c0e91471ab
> > commit: fad84e39f116035ae8d550c6020107b8ac113b45 ARC: boot log: eliminate struct cpuinfo_arc #4: boot log per ISA
> > config: arc-randconfig-r071-20231128 (https://download.01.org/0day-ci/archive/20231128/[email protected]/config)
> > compiler: arceb-elf-gcc (GCC) 13.2.0
> > reproduce: (https://download.01.org/0day-ci/archive/20231128/[email protected]/reproduce)
> >
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <[email protected]>
> > | Reported-by: Dan Carpenter <[email protected]>
> > | Closes: https://lore.kernel.org/r/[email protected]/
> >
> > New smatch warnings:
> > arch/arc/kernel/setup.c:203 arcv2_mumbojumbo() error: uninitialized symbol 'release'.
>
> Thx, I've posted a fix.
>
> > Old smatch warnings:
> > arch/arc/include/asm/thread_info.h:62 current_thread_info() error: uninitialized symbol 'sp'.
>
> This seems like a false warning. Its a register variable and thus can't
> possibly be initialized.

Yeah. Sorry, I normally delete these but I somehow forgot this time.

regards,
dan carpenter