Linux Kernel Selftest development
 help / color / mirror / Atom feed
* [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
@ 2024-11-04 17:16 Dan Carpenter
  2024-11-09  9:33 ` David Gow
  2024-11-09 17:00 ` Kuan-Wei Chiu
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2024-11-04 17:16 UTC (permalink / raw)
  To: Benjamin Berg
  Cc: Brendan Higgins, David Gow, Rae Moar, linux-kselftest, kunit-dev,
	linux-kernel, kernel-janitors

The intent here was clearly to use the gfp variable flags instead of
hardcoding GFP_KERNEL.  All the callers pass GFP_KERNEL as the gfp
flags so this doesn't affect runtime.

Fixes: b3231d353a51 ("kunit: add a convenience allocation wrapper for SKBs")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 include/kunit/skbuff.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/kunit/skbuff.h b/include/kunit/skbuff.h
index 44d12370939a..345e1e8f0312 100644
--- a/include/kunit/skbuff.h
+++ b/include/kunit/skbuff.h
@@ -29,7 +29,7 @@ static void kunit_action_kfree_skb(void *p)
 static inline struct sk_buff *kunit_zalloc_skb(struct kunit *test, int len,
 					       gfp_t gfp)
 {
-	struct sk_buff *res = alloc_skb(len, GFP_KERNEL);
+	struct sk_buff *res = alloc_skb(len, gfp);
 
 	if (!res || skb_pad(res, len))
 		return NULL;
-- 
2.45.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
  2024-11-04 17:16 [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL Dan Carpenter
@ 2024-11-09  9:33 ` David Gow
  2024-11-09 17:00 ` Kuan-Wei Chiu
  1 sibling, 0 replies; 3+ messages in thread
From: David Gow @ 2024-11-09  9:33 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Benjamin Berg, Brendan Higgins, Rae Moar, linux-kselftest,
	kunit-dev, linux-kernel, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1154 bytes --]

On Tue, 5 Nov 2024 at 01:16, Dan Carpenter <dan.carpenter@linaro.org> wrote:
>
> The intent here was clearly to use the gfp variable flags instead of
> hardcoding GFP_KERNEL.  All the callers pass GFP_KERNEL as the gfp
> flags so this doesn't affect runtime.
>
> Fixes: b3231d353a51 ("kunit: add a convenience allocation wrapper for SKBs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>\
> ---

Nice catch, thanks.

Reviewed-by: David Gow <davidgow@google.com>

Cheers,
-- David


>  include/kunit/skbuff.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/kunit/skbuff.h b/include/kunit/skbuff.h
> index 44d12370939a..345e1e8f0312 100644
> --- a/include/kunit/skbuff.h
> +++ b/include/kunit/skbuff.h
> @@ -29,7 +29,7 @@ static void kunit_action_kfree_skb(void *p)
>  static inline struct sk_buff *kunit_zalloc_skb(struct kunit *test, int len,
>                                                gfp_t gfp)
>  {
> -       struct sk_buff *res = alloc_skb(len, GFP_KERNEL);
> +       struct sk_buff *res = alloc_skb(len, gfp);
>
>         if (!res || skb_pad(res, len))
>                 return NULL;
> --
> 2.45.2
>

[-- Attachment #2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 5294 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL
  2024-11-04 17:16 [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL Dan Carpenter
  2024-11-09  9:33 ` David Gow
@ 2024-11-09 17:00 ` Kuan-Wei Chiu
  1 sibling, 0 replies; 3+ messages in thread
From: Kuan-Wei Chiu @ 2024-11-09 17:00 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Benjamin Berg, Brendan Higgins, David Gow, Rae Moar,
	linux-kselftest, kunit-dev, linux-kernel, kernel-janitors

On Mon, Nov 04, 2024 at 08:16:30PM +0300, Dan Carpenter wrote:
> The intent here was clearly to use the gfp variable flags instead of
> hardcoding GFP_KERNEL.  All the callers pass GFP_KERNEL as the gfp
> flags so this doesn't affect runtime.
> 
> Fixes: b3231d353a51 ("kunit: add a convenience allocation wrapper for SKBs")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>

The kernel doc comment for kunit_zalloc_skb() is missing a mention of
the gfp parameter. Additionally, the comment says "Allocate a new
struct sk_buff with GFP_KERNEL," which should replace GFP_KERNEL with
@gfp. It might be better to fix both issues in the comment together.
With the above corrections:

Reviewed-by: Kuan-Wei Chiu <visitorckw@gmail.com>

Regards,
Kuan-Wei
> ---
>  include/kunit/skbuff.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/kunit/skbuff.h b/include/kunit/skbuff.h
> index 44d12370939a..345e1e8f0312 100644
> --- a/include/kunit/skbuff.h
> +++ b/include/kunit/skbuff.h
> @@ -29,7 +29,7 @@ static void kunit_action_kfree_skb(void *p)
>  static inline struct sk_buff *kunit_zalloc_skb(struct kunit *test, int len,
>  					       gfp_t gfp)
>  {
> -	struct sk_buff *res = alloc_skb(len, GFP_KERNEL);
> +	struct sk_buff *res = alloc_skb(len, gfp);
>  
>  	if (!res || skb_pad(res, len))
>  		return NULL;
> -- 
> 2.45.2
> 
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-11-09 17:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-04 17:16 [PATCH] kunit: skb: use "gfp" variable instead of hardcoding GFP_KERNEL Dan Carpenter
2024-11-09  9:33 ` David Gow
2024-11-09 17:00 ` Kuan-Wei Chiu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox