oe-kbuild.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: oe-kbuild@lists.linux.dev, Ben Skeggs <bskeggs@redhat.com>
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
	Linux Memory Management List <linux-mm@kvack.org>,
	Lyude Paul <lyude@redhat.com>
Subject: [linux-next:master 5613/8327] drivers/gpu/drm/nouveau/nouveau_dp.c:237 nouveau_dp_irq() warn: variable dereferenced before check 'outp' (see line 232)
Date: Thu, 17 Nov 2022 10:47:14 +0300	[thread overview]
Message-ID: <202211170722.QtP5uInh-lkp@intel.com> (raw)
Message-ID: <20221117074714.MkABlsrkVe01TMI9pWTrwDBEU_o9Jsr64Q5y9ieNblA@z> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   15f3bff12cf6a888ec2ad39652828c60e6836b3d
commit: 773eb04d14a11552b2c3953097ed09cde2ab4831 [5613/8327] drm/nouveau/disp: expose conn event class
config: loongarch-randconfig-m041-20221114
compiler: loongarch64-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>

smatch warnings:
drivers/gpu/drm/nouveau/nouveau_dp.c:237 nouveau_dp_irq() warn: variable dereferenced before check 'outp' (see line 232)

vim +/outp +237 drivers/gpu/drm/nouveau/nouveau_dp.c

773eb04d14a1155 Ben Skeggs 2022-06-01  225  void
773eb04d14a1155 Ben Skeggs 2022-06-01  226  nouveau_dp_irq(struct work_struct *work)
a0922278f83eae0 Lyude Paul 2020-08-26  227  {
773eb04d14a1155 Ben Skeggs 2022-06-01  228  	struct nouveau_connector *nv_connector =
773eb04d14a1155 Ben Skeggs 2022-06-01  229  		container_of(work, typeof(*nv_connector), irq_work);
a0922278f83eae0 Lyude Paul 2020-08-26  230  	struct drm_connector *connector = &nv_connector->base;
a0922278f83eae0 Lyude Paul 2020-08-26  231  	struct nouveau_encoder *outp = find_encoder(connector, DCB_OUTPUT_DP);
773eb04d14a1155 Ben Skeggs 2022-06-01 @232  	struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev);
                                                                                      ^^^^^^
New dereference.

a0922278f83eae0 Lyude Paul 2020-08-26  233  	struct nv50_mstm *mstm;
016dacb60e6d4b3 Ben Skeggs 2022-06-01  234  	u64 hpd = 0;
a4efad354cf1b9d Lyude Paul 2020-08-26  235  	int ret;
a0922278f83eae0 Lyude Paul 2020-08-26  236  
a0922278f83eae0 Lyude Paul 2020-08-26 @237  	if (!outp)
                                                    ^^^^^
Checked too late.

a0922278f83eae0 Lyude Paul 2020-08-26  238  		return;
a0922278f83eae0 Lyude Paul 2020-08-26  239  
a0922278f83eae0 Lyude Paul 2020-08-26  240  	mstm = outp->dp.mstm;
a0922278f83eae0 Lyude Paul 2020-08-26  241  	NV_DEBUG(drm, "service %s\n", connector->name);
a0922278f83eae0 Lyude Paul 2020-08-26  242  
a0922278f83eae0 Lyude Paul 2020-08-26  243  	mutex_lock(&outp->dp.hpd_irq_lock);
a0922278f83eae0 Lyude Paul 2020-08-26  244  
a0922278f83eae0 Lyude Paul 2020-08-26  245  	if (mstm && mstm->is_mst) {
a0922278f83eae0 Lyude Paul 2020-08-26  246  		if (!nv50_mstm_service(drm, nv_connector, mstm))
773eb04d14a1155 Ben Skeggs 2022-06-01  247  			hpd |= NVIF_CONN_EVENT_V0_UNPLUG;
a0922278f83eae0 Lyude Paul 2020-08-26  248  	} else {
a0922278f83eae0 Lyude Paul 2020-08-26  249  		drm_dp_cec_irq(&nv_connector->aux);
a4efad354cf1b9d Lyude Paul 2020-08-26  250  
a4efad354cf1b9d Lyude Paul 2020-08-26  251  		if (nouveau_dp_has_sink_count(connector, outp)) {
a4efad354cf1b9d Lyude Paul 2020-08-26  252  			ret = drm_dp_read_sink_count(&nv_connector->aux);
a4efad354cf1b9d Lyude Paul 2020-08-26  253  			if (ret != outp->dp.sink_count)
773eb04d14a1155 Ben Skeggs 2022-06-01  254  				hpd |= NVIF_CONN_EVENT_V0_PLUG;
a4efad354cf1b9d Lyude Paul 2020-08-26  255  			if (ret >= 0)
a4efad354cf1b9d Lyude Paul 2020-08-26  256  				outp->dp.sink_count = ret;
a4efad354cf1b9d Lyude Paul 2020-08-26  257  		}
a0922278f83eae0 Lyude Paul 2020-08-26  258  	}
a0922278f83eae0 Lyude Paul 2020-08-26  259  
a0922278f83eae0 Lyude Paul 2020-08-26  260  	mutex_unlock(&outp->dp.hpd_irq_lock);
a4efad354cf1b9d Lyude Paul 2020-08-26  261  
773eb04d14a1155 Ben Skeggs 2022-06-01  262  	nouveau_connector_hpd(nv_connector, NVIF_CONN_EVENT_V0_IRQ | hpd);
a0922278f83eae0 Lyude Paul 2020-08-26  263  }

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp


             reply	other threads:[~2022-11-17  7:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-16 23:11 kernel test robot [this message]
2022-11-17  7:47 ` [linux-next:master 5613/8327] drivers/gpu/drm/nouveau/nouveau_dp.c:237 nouveau_dp_irq() warn: variable dereferenced before check 'outp' (see line 232) 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=202211170722.QtP5uInh-lkp@intel.com \
    --to=error27@gmail.com \
    --cc=bskeggs@redhat.com \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=lyude@redhat.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    --cc=oe-kbuild@lists.linux.dev \
    /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;
as well as URLs for NNTP newsgroup(s).