mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Kunwu Chan <chentao@kylinos.cn>,
	jgross@suse.com, boris.ostrovsky@oracle.com, tglx@linutronix.de,
	mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com,
	x86@kernel.org, hpa@zytor.com
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
	xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org,
	Kunwu Chan <chentao@kylinos.cn>
Subject: Re: [PATCH] x86/xen: Fix some null pointer dereference issues in smp.c
Date: Tue, 16 Jan 2024 11:45:50 +0800	[thread overview]
Message-ID: <202401161119.iof6BQsf-lkp@intel.com> (raw)
In-Reply-To: <20240115100138.34340-1-chentao@kylinos.cn>

Hi Kunwu,

kernel test robot noticed the following build warnings:

[auto build test WARNING on tip/x86/core]
[also build test WARNING on linus/master v6.7 next-20240112]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Kunwu-Chan/x86-xen-Fix-some-null-pointer-dereference-issues-in-smp-c/20240115-180429
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/20240115100138.34340-1-chentao%40kylinos.cn
patch subject: [PATCH] x86/xen: Fix some null pointer dereference issues in smp.c
config: x86_64-rhel-8.3-rust (https://download.01.org/0day-ci/archive/20240116/202401161119.iof6BQsf-lkp@intel.com/config)
compiler: ClangBuiltLinux clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240116/202401161119.iof6BQsf-lkp@intel.com/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 <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202401161119.iof6BQsf-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> arch/x86/xen/smp.c:68:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized]
      68 |         if (!resched_name)
         |             ^~~~~~~~~~~~~
   arch/x86/xen/smp.c:127:9: note: uninitialized use occurs here
     127 |         return rc;
         |                ^~
   arch/x86/xen/smp.c:68:2: note: remove the 'if' if its condition is always false
      68 |         if (!resched_name)
         |         ^~~~~~~~~~~~~~~~~~
      69 |                 goto fail;
         |                 ~~~~~~~~~
   arch/x86/xen/smp.c:64:8: note: initialize the variable 'rc' to silence this warning
      64 |         int rc;
         |               ^
         |                = 0
   1 warning generated.


vim +68 arch/x86/xen/smp.c

    61	
    62	int xen_smp_intr_init(unsigned int cpu)
    63	{
    64		int rc;
    65		char *resched_name, *callfunc_name, *debug_name;
    66	
    67		resched_name = kasprintf(GFP_KERNEL, "resched%d", cpu);
  > 68		if (!resched_name)
    69			goto fail;
    70		per_cpu(xen_resched_irq, cpu).name = resched_name;
    71		rc = bind_ipi_to_irqhandler(XEN_RESCHEDULE_VECTOR,
    72					    cpu,
    73					    xen_reschedule_interrupt,
    74					    IRQF_PERCPU|IRQF_NOBALANCING,
    75					    resched_name,
    76					    NULL);
    77		if (rc < 0)
    78			goto fail;
    79		per_cpu(xen_resched_irq, cpu).irq = rc;
    80	
    81		callfunc_name = kasprintf(GFP_KERNEL, "callfunc%d", cpu);
    82		if (!callfunc_name)
    83			goto fail;
    84		per_cpu(xen_callfunc_irq, cpu).name = callfunc_name;
    85		rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_VECTOR,
    86					    cpu,
    87					    xen_call_function_interrupt,
    88					    IRQF_PERCPU|IRQF_NOBALANCING,
    89					    callfunc_name,
    90					    NULL);
    91		if (rc < 0)
    92			goto fail;
    93		per_cpu(xen_callfunc_irq, cpu).irq = rc;
    94	
    95		if (!xen_fifo_events) {
    96			debug_name = kasprintf(GFP_KERNEL, "debug%d", cpu);
    97			if (!debug_name)
    98				goto fail;
    99			per_cpu(xen_debug_irq, cpu).name = debug_name;
   100			rc = bind_virq_to_irqhandler(VIRQ_DEBUG, cpu,
   101						     xen_debug_interrupt,
   102						     IRQF_PERCPU | IRQF_NOBALANCING,
   103						     debug_name, NULL);
   104			if (rc < 0)
   105				goto fail;
   106			per_cpu(xen_debug_irq, cpu).irq = rc;
   107		}
   108	
   109		callfunc_name = kasprintf(GFP_KERNEL, "callfuncsingle%d", cpu);
   110		if (!callfunc_name)
   111			goto fail;
   112		per_cpu(xen_callfuncsingle_irq, cpu).name = callfunc_name;
   113		rc = bind_ipi_to_irqhandler(XEN_CALL_FUNCTION_SINGLE_VECTOR,
   114					    cpu,
   115					    xen_call_function_single_interrupt,
   116					    IRQF_PERCPU|IRQF_NOBALANCING,
   117					    callfunc_name,
   118					    NULL);
   119		if (rc < 0)
   120			goto fail;
   121		per_cpu(xen_callfuncsingle_irq, cpu).irq = rc;
   122	
   123		return 0;
   124	
   125	 fail:
   126		xen_smp_intr_free(cpu);
   127		return rc;
   128	}
   129	

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

      reply	other threads:[~2024-01-16  3:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-15 10:01 Kunwu Chan
2024-01-16  3:45 ` kernel test robot [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202401161119.iof6BQsf-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=bp@alien8.de \
    --cc=chentao@kylinos.cn \
    --cc=dave.hansen@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jgross@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=mingo@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=tglx@linutronix.de \
    --cc=x86@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®