Please find the patch below.
Thanks and regards,
Gaurav.
From Gaurav Singh <[email protected]> # This line is ignored.
From: Gaurav Singh <[email protected]>
Reply-To:
Subject:
In-Reply-To:
Signed-off-by: Gaurav Singh <[email protected]>
---
samples/bpf/xdp_rxq_info_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
index 4fe47502ebed..490b07b7df78 100644
--- a/samples/bpf/xdp_rxq_info_user.c
+++ b/samples/bpf/xdp_rxq_info_user.c
@@ -202,11 +202,11 @@ static struct datarec *alloc_record_per_cpu(void)
size = sizeof(struct datarec) * nr_cpus;
array = malloc(size);
- memset(array, 0, size);
if (!array) {
fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
exit(EXIT_FAIL_MEM);
}
+ memset(array, 0, size);
return array;
}
--
2.17.1
On Tue, Jun 09, 2020 at 07:38:38AM -0400, Gaurav Singh wrote:
> Please find the patch below.
>
> Thanks and regards,
> Gaurav.
>
> >From Gaurav Singh <[email protected]> # This line is ignored.
> From: Gaurav Singh <[email protected]>
> Reply-To:
> Subject:
> In-Reply-To:
>
>
I think something went wrong in your submission, just use 'git
send-email' to send the patch out.
thanks,
greg k-h
On Tue, Jun 09, 2020 at 07:38:39AM -0400, Gaurav Singh wrote:
> Signed-off-by: Gaurav Singh <[email protected]>
> ---
> samples/bpf/xdp_rxq_info_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
I know I don't take patches without any changelog text, maybe other
maintainers are more lax...
On Tue, 9 Jun 2020 08:08:03 -0400
Gaurav Singh <[email protected]> wrote:
> The memset call is made right after malloc call. To fix this, add the null check right after malloc and then do memset.
>
Did you read the section about how long lines should be in desc?
> Signed-off-by: Gaurav Singh <[email protected]>
> ---
> samples/bpf/xdp_rxq_info_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/samples/bpf/xdp_rxq_info_user.c b/samples/bpf/xdp_rxq_info_user.c
> index 4fe47502ebed..490b07b7df78 100644
> --- a/samples/bpf/xdp_rxq_info_user.c
> +++ b/samples/bpf/xdp_rxq_info_user.c
> @@ -202,11 +202,11 @@ static struct datarec *alloc_record_per_cpu(void)
>
> size = sizeof(struct datarec) * nr_cpus;
> array = malloc(size);
> - memset(array, 0, size);
> if (!array) {
> fprintf(stderr, "Mem alloc error (nr_cpus:%u)\n", nr_cpus);
> exit(EXIT_FAIL_MEM);
> }
> + memset(array, 0, size);
> return array;
> }
Looking at code, this bug happen in more places. Please fix up all locations.
I think this fix should go through the "bpf" tree.
Please read:
https://github.com/torvalds/linux/blob/master/Documentation/bpf/bpf_devel_QA.rst
--
Best regards,
Jesper Dangaard Brouer
MSc.CS, Principal Kernel Engineer at Red Hat
LinkedIn: http://www.linkedin.com/in/brouer