mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Thomas Zimmermann <tzimmermann@suse.de>
To: suijingfeng <suijingfeng@loongson.cn>,
	David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
	Li Yi <liyi@loongson.cn>
Cc: loongson-kernel@lists.loongnix.cn,
	Dan Carpenter <dan.carpenter@linaro.org>,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/loongson: Remove a useless check in cursor_plane_atomic_async_check()
Date: Mon, 10 Jul 2023 13:51:38 +0200	[thread overview]
Message-ID: <45925a3e-40ec-7509-b9da-53c11594f6d7@suse.de> (raw)
In-Reply-To: <8182fecd-d290-293a-d963-ddbea79dbf03@loongson.cn>


[-- Attachment #1.1: Type: text/plain, Size: 4028 bytes --]

Hi

Am 10.07.23 um 13:34 schrieb suijingfeng:
> Hi,
> 
> On 2023/7/10 18:39, Thomas Zimmermann wrote:
>>
>>
>> Am 10.07.23 um 12:24 schrieb Sui Jingfeng:
>>> Because smatch warnings:
>>>
>>> drivers/gpu/drm/loongson/lsdc_plane.c:199
>>> lsdc_cursor_plane_atomic_async_check()
>>> warn: variable dereferenced before check 'state' (see line 180)
>>>
>>> vim +/state +199 drivers/gpu/drm/loongson/lsdc_plane.c
>>>
>>> 174  static int
>>>       lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane,
>>> 175                                       struct drm_atomic_state 
>>> *state)
>>> 176  {
>>> 177          struct drm_plane_state *new_state;
>>> 178          struct drm_crtc_state *crtc_state;
>>> 179
>>> 180          new_state = drm_atomic_get_new_plane_state(state, plane);
>>>                                                          ^^^^^
>>> state is dereferenced inside this function
>>>
>>> 181
>>> 182  if (!plane->state || !plane->state->fb) {
>>> 183          drm_dbg(plane->dev, "%s: state is NULL\n", plane->name);
>>> 184                  return -EINVAL;
>>> 185  }
>>> 186
>>> 187  if (new_state->crtc_w != new_state->crtc_h) {
>>> 188          drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n",
>>> 189                  new_state->crtc_w, new_state->crtc_h);
>>> 190          return -EINVAL;
>>> 191  }
>>> 192
>>> 193  if (new_state->crtc_w != 64 && new_state->crtc_w != 32) {
>>> 194          drm_dbg(plane->dev, "unsupported cursor size: %ux%u\n",
>>> 195                  new_state->crtc_w, new_state->crtc_h);
>>> 196          return -EINVAL;
>>> 197  }
>>> 198
>>> 199  if (state) {
>>>           ^^^^^
>>> Checked too late!
>>>
>>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>>> Closes: https://lore.kernel.org/r/202307100423.rV7D05Uq-lkp@intel.com/
>>> Signed-off-by: Sui Jingfeng <suijingfeng@loongson.cn>
>>
>> Acked-by: Thomas Zimmermann <tzimmermann@suse.de>
>>
>> BTW, you're posting these patches for loongson, 
> 
> I'm posting these patches for the drm/loongson driver in drm-misc and/or 
> drm-tip branch,
> 
> what do you means for *loongson*,
> 
>> but that driver is not yet in our tree?
>>
> 
> I already applied(push) drm/loongson driver to drm-misc-next branch,
> 
> What do you means that by "not yet in our tree", linux kernel side?
> 
> Am I missing something ?

No, it's my fault. I didn't update my branches correctly. :)

Best regards
Thomas

> 
> 
>> Best regards
>> Thomas
>>
>>
>>> ---
>>>   drivers/gpu/drm/loongson/lsdc_plane.c | 8 +-------
>>>   1 file changed, 1 insertion(+), 7 deletions(-)
>>>
>>> diff --git a/drivers/gpu/drm/loongson/lsdc_plane.c 
>>> b/drivers/gpu/drm/loongson/lsdc_plane.c
>>> index 2ab3db982aa3..0d5094633222 100644
>>> --- a/drivers/gpu/drm/loongson/lsdc_plane.c
>>> +++ b/drivers/gpu/drm/loongson/lsdc_plane.c
>>> @@ -196,13 +196,7 @@ static int 
>>> lsdc_cursor_plane_atomic_async_check(struct drm_plane *plane,
>>>           return -EINVAL;
>>>       }
>>>   -    if (state) {
>>> -        crtc_state = drm_atomic_get_existing_crtc_state(state, 
>>> new_state->crtc);
>>> -    } else {
>>> -        crtc_state = plane->crtc->state;
>>> -        drm_dbg(plane->dev, "%s: atomic state is NULL\n", plane->name);
>>> -    }
>>> -
>>> +    crtc_state = drm_atomic_get_existing_crtc_state(state, 
>>> new_state->crtc);
>>>       if (!crtc_state->active)
>>>           return -EINVAL;
>>
> 

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

      parent reply	other threads:[~2023-07-10 11:51 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-10 10:24 Sui Jingfeng
2023-07-10 10:39 ` Thomas Zimmermann
2023-07-10 11:34   ` suijingfeng
2023-07-10 11:46     ` Jani Nikula
2023-07-10 11:59       ` Thomas Zimmermann
2023-07-10 12:07         ` Jani Nikula
2023-07-10 11:51     ` Thomas Zimmermann [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=45925a3e-40ec-7509-b9da-53c11594f6d7@suse.de \
    --to=tzimmermann@suse.de \
    --cc=airlied@gmail.com \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liyi@loongson.cn \
    --cc=loongson-kernel@lists.loongnix.cn \
    --cc=suijingfeng@loongson.cn \
    /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®