mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Longsuhui <Jack_sun@tom.com>
To: Dan Carpenter <dan.carpenter@linaro.org>, Su Hui <suhui@nfschina.com>
Cc: alexander.deucher@amd.com, airlied@gmail.com, Xinhui.Pan@amd.com,
	daniel@ffwll.ch, David.Francis@amd.com, Jane.Jian@amd.com,
	Bokun.Zhang@amd.com, monk.liu@amd.com,
	amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] drm/amd/amdgpu: Properly tune the size of struct
Date: Tue, 20 Jun 2023 15:57:22 +0800	[thread overview]
Message-ID: <c12c4031-52fb-25a2-b411-e668eb9baaa2@tom.com> (raw)
In-Reply-To: <da6c860f-0ef0-44e4-8b58-0f4d55c1b8bd@kadam.mountain>

On 2023/6/20 15:37, Dan Carpenter wrote:
> On Tue, Jun 20, 2023 at 12:59:19PM +0800, Su Hui wrote:
>> Smatch error:
>>      gpu/drm/amd/amdgpu/amdgv_sriovmsg.h:316:49: error:
>>      static assertion failed: "amd_sriov_msg_pf2vf_info must be 1 KB"
>>      static assertion failed: "amd_sriov_msg_vf2pf_info must be 1 KB"
>>
> I doubt that moving the struct members around is safe.  This looks like
> it's in a very specific order.  So I don't think this patch is correct.
>
> The reason for this false positive this code uses a #pragma to pack the
> struct.
>
> #pragma pack(push, 1) // PF2VF / VF2PF data areas are byte packed

Oh, Sorry, I didn't see this code.

This patch is error, and sorry for the noise.

> Sparse does not support this and Smatch uses Sparse as a parser.  The
> main reason why Sparse doesn't support this pragma is because Linus
> thinks it's gross.  You probably didn't even see the #pragma did you?
> And anything you can't see is unreadable by definition.
>
> "Mark the associated types properly packed individually, rather than
> use the disgusting "pragma pack()" that should never be used."
>
> https://lore.kernel.org/linux-sparse/CAHk-=wi7jGZ+bVbt-UfXOkpEQdHzF3Z2HBjkGdjh8q4dvPPGWQ@mail.gmail.com/
>
> regards,
> dan carpenter

  parent reply	other threads:[~2023-06-20  7:58 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-20  4:59 Su Hui
2023-06-20  7:37 ` Dan Carpenter
2023-06-20  7:44   ` Dan Carpenter
2023-06-20  7:57   ` Longsuhui [this message]
2023-06-21  0:41 ` kernel test robot
2023-06-23  5:45 ` kernel test robot
2023-06-23 12:25 ` kernel test robot
2023-06-25 21:15 ` kernel test robot
2024-07-29 13:58 WangYuli

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=c12c4031-52fb-25a2-b411-e668eb9baaa2@tom.com \
    --to=jack_sun@tom.com \
    --cc=Bokun.Zhang@amd.com \
    --cc=David.Francis@amd.com \
    --cc=Jane.Jian@amd.com \
    --cc=Xinhui.Pan@amd.com \
    --cc=airlied@gmail.com \
    --cc=alexander.deucher@amd.com \
    --cc=amd-gfx@lists.freedesktop.org \
    --cc=dan.carpenter@linaro.org \
    --cc=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=monk.liu@amd.com \
    --cc=suhui@nfschina.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

Powered by JetHome