public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Colin King (gmail)" <colin.i.king@gmail.com>
To: Roger Lu <roger.lu@mediatek.com>
Cc: AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Kevin Hilman <khilman@baylibre.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: re: soc: mediatek: SVS: introduce MTK SVS engine
Date: Wed, 22 Jun 2022 13:02:23 +0100	[thread overview]
Message-ID: <7f995d57-c40b-6c32-e776-677ae1496769@gmail.com> (raw)

Hi,

static analysis on linux-next with clang scan-build has detected a null 
pointer dereference in the following commit:

commit 681a02e9500073cd8b9c25a04f06166254b5a879
Author: Roger Lu <roger.lu@mediatek.com>
Date:   Mon May 16 08:43:07 2022 +0800

     soc: mediatek: SVS: introduce MTK SVS engine


The issue is as follows:

static irqreturn_t svs_isr(int irq, void *data)
{
         struct svs_platform *svsp = data;
         struct svs_bank *svsb = NULL;
         unsigned long flags;
         u32 idx, int_sts, svs_en;

         for (idx = 0; idx < svsp->bank_max; idx++) {
                 svsb = &svsp->banks[idx];
                 WARN(!svsb, "%s: svsb(%s) is null", __func__, svsb->name);
                 spin_lock_irqsave(&svs_lock, flags);
                 svsp->pbank = svsb;


If svsb is null, then the WARN message will dereference it when printing 
svsb->name.  Also, subsequent dereferences to sbsv will cause a null 
pointer dereference, for example the svsp->pbank assignment.

Colin

             reply	other threads:[~2022-06-22 12:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-22 12:02 Colin King (gmail) [this message]
2022-06-22 13:37 ` soc: mediatek: SVS: introduce MTK SVS engine Matthias Brugger

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=7f995d57-c40b-6c32-e776-677ae1496769@gmail.com \
    --to=colin.i.king@gmail.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=khilman@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matthias.bgg@gmail.com \
    --cc=roger.lu@mediatek.com \
    /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