All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Rex.Zhu@amd.com
Cc: dri-devel@lists.freedesktop.org
Subject: re: drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7.
Date: Tue, 11 Oct 2016 10:11:05 +0300	[thread overview]
Message-ID: <20161011071105.GA17853@mwanda> (raw)

Hello Rex Zhu,

This is a semi-automatic email about new static checker warnings.

The patch 599a7e9fe1b6: "drm/amd/powerplay: implement smu7 hwmgr to 
manager asics with smu ip version 7." from Sep 9, 2016, leads to the 
following Smatch complaint:

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c:3809 smu7_check_states_equal()
	 warn: variable dereferenced before check 'pstate1' (see line 3805)

drivers/gpu/drm/amd/amdgpu/../powerplay/hwmgr/smu7_hwmgr.c
  3804	{
  3805		const struct smu7_power_state *psa = cast_const_phw_smu7_power_state(pstate1);
                                                                                     ^^^^^^^
  3806		const struct smu7_power_state *psb = cast_const_phw_smu7_power_state(pstate2);
                                                                                     ^^^^^^^
New dereferences.

  3807		int i;
  3808	
  3809		if (pstate1 == NULL || pstate2 == NULL || equal == NULL)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Checked too late.

Just as an aside.  People really don't review code in initializers.
I've commented on this before, and other people have noted it as well
but other people are like "In that case, those people shouldn't be
kernel devs!" which is so ignorant.  Everyone consistently makes the
same mistakes.  I've spent so many hours looking at basically this same
bug over and over and everyone does it.

That's nothing to do with your code, in particular, I just wanted to
update you on how my morning has been going.  (Pretty well, thanks,
although I'm due for a second cup of coffee).

  3810			return -EINVAL;
  3811	

regards,
dan carpenter
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2016-10-11  7:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11  7:11 Dan Carpenter [this message]
2016-10-11 11:17 ` drm/amd/powerplay: implement smu7 hwmgr to manager asics with smu ip version 7 Zhu, Rex
2016-10-11 11:55   ` Christian König

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=20161011071105.GA17853@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=Rex.Zhu@amd.com \
    --cc=dri-devel@lists.freedesktop.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 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.