All of lore.kernel.org
 help / color / mirror / Atom feed
From: Souptick Joarder <jrdr.linux@gmail.com>
To: martyn@welchs.me.uk, manohar.vanga@gmail.com,
	gregkh@linuxfoundation.org, alexandre.belloni@bootlin.com,
	rafael@kernel.org, mathieu.poirier@linaro.org,
	u.kleine-koenig@pengutronix.de, arnd@arndb.de
Cc: linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev,
	"Souptick Joarder (HPE)" <jrdr.linux@gmail.com>,
	Kernel test robot <lkp@intel.com>
Subject: [PATCH] vme: Added NULL check for bridge
Date: Sun, 19 Jun 2022 12:36:45 +0530	[thread overview]
Message-ID: <20220619070645.100947-1-jrdr.linux@gmail.com> (raw)

From: "Souptick Joarder (HPE)" <jrdr.linux@gmail.com>

Kernel test robot throws below warning ->
drivers/staging/vme_user/vme.c:662:20: warning: dereference
of NULL 'bridge' [CWE-476] [-Wanalyzer-null-dereference]

Added a NULL check.

Reported-by: Kernel test robot <lkp@intel.com>
Signed-off-by: Souptick Joarder (HPE) <jrdr.linux@gmail.com>
---
 drivers/staging/vme_user/vme.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c
index b5555683a069..ede774f2fe5a 100644
--- a/drivers/staging/vme_user/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -659,7 +659,7 @@ ssize_t vme_master_read(struct vme_resource *resource, void *buf, size_t count,
 	struct vme_master_resource *image;
 	size_t length;
 
-	if (!bridge->master_read) {
+	if (bridge && !bridge->master_read) {
 		printk(KERN_WARNING "Reading from resource not supported\n");
 		return -EINVAL;
 	}
-- 
2.25.1


             reply	other threads:[~2022-06-19  7:06 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-19  7:06 Souptick Joarder [this message]
2022-06-20  8:02 ` [PATCH] vme: Added NULL check for bridge Greg KH
2022-06-20  8:49 ` Dan Carpenter

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=20220619070645.100947-1-jrdr.linux@gmail.com \
    --to=jrdr.linux@gmail.com \
    --cc=alexandre.belloni@bootlin.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=lkp@intel.com \
    --cc=manohar.vanga@gmail.com \
    --cc=martyn@welchs.me.uk \
    --cc=mathieu.poirier@linaro.org \
    --cc=rafael@kernel.org \
    --cc=u.kleine-koenig@pengutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.