public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Liu Ye <liuye@kylinos.cn>
Cc: horms@kernel.org, davem@davemloft.net, edumazet@google.com,
	herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org,
	linux-kselftest@vger.kernel.org, netdev@vger.kernel.org,
	pabeni@redhat.com, shuah@kernel.org,
	steffen.klassert@secunet.com
Subject: Re: [PATCH net V2] selftests/net/ipsec: Fix Null pointer dereference in rtattr_pack()
Date: Wed, 15 Jan 2025 14:19:40 -0800	[thread overview]
Message-ID: <20250115141940.399ecd28@kernel.org> (raw)
In-Reply-To: <20250115031322.43561-1-liuye@kylinos.cn>

On Wed, 15 Jan 2025 11:13:22 +0800 Liu Ye wrote:
> From: liuye <liuye@kylinos.cn>
> 
> From: Liu Ye <liuye@kylinos.cn>

too many From lines.

> Address Null pointer dereference in rtattr_pack.

I think size is 0 in the bad case, so it's more of an undefinied
behavior.

> Flagged by cppcheck as:
>     tools/testing/selftests/net/ipsec.c:230:25: warning: Possible null pointer
>     dereference: payload [nullPointer]
>     memcpy(RTA_DATA(attr), payload, size);
>                            ^
>     tools/testing/selftests/net/ipsec.c:1618:54: note: Calling function 'rtattr_pack',
>     4th argument 'NULL' value is 0
>     if (rtattr_pack(&req.nh, sizeof(req), XFRMA_IF_ID, NULL, 0)) {
>                                                        ^
>     tools/testing/selftests/net/ipsec.c:230:25: note: Null pointer dereference
>     memcpy(RTA_DATA(attr), payload, size);
>                            ^
> Fixes: 70bfdf62e93a ("selftests/net/ipsec: Add test for xfrm_spdattr_type_t")

Your Sign-off needs to be right after fixes.

> ---
> V2: Modify description.
>     Add code checking tools.
>     Separating family and given name in Signed-off-by line.
>     Modify code format.
>     Add fixes.
> ---

Please post v3 as a new thread (not in reply to).
-- 
pw-bot: cr

      reply	other threads:[~2025-01-15 22:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-01-14  7:43 [PATCH] selftests/net/ipsec: Fix Null pointer dereference in rtattr_pack() liuye
2025-01-14 16:01 ` Simon Horman
2025-01-15  3:13   ` [PATCH net V2] " Liu Ye
2025-01-15 22:19     ` Jakub Kicinski [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=20250115141940.399ecd28@kernel.org \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=horms@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=liuye@kylinos.cn \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=steffen.klassert@secunet.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