lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 8 Jun 2020 16:15:43 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     gaurav singh <gaurav1086@...il.com>, ast@...nel.org, kafai@...com,
        songliubraving@...com, yhs@...com, andriin@...com,
        john.fastabend@...il.com, kpsingh@...omium.org,
        davem@...emloft.net, kuba@...nel.org, awk@...nel.org
Cc:     netdev@...r.kernel.org, bpf@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bpf_stats_record: Add null check after malloc

On 6/7/20 1:46 AM, gaurav singh wrote:
> Hi,
> 
> The memset call is made right after malloc call. To fix this, add the null
> check right after malloc and then do memset.
> 
> Please find the patch below.
> 
> Thanks and regards,
> Gaurav.

Hello Gaurav, your patch is whitespace damaged. Please try and resubmit with git-send-email.

>  From 8083a35f85c6047f0377883ed66ae147f85fd3a9 Mon Sep 17 00:00:00 2001
> From: Gaurav Singh <gaurav1086@...il.com>
> Date: Sat, 6 Jun 2020 19:42:53 -0400
> Subject: [PATCH] bpf_stats_record: Add null check after malloc
> 
> Signed-off-by: Gaurav Singh <gaurav1086@...il.com>
> ---
>   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..c44b9a844066 100644
> --- a/samples/bpf/xdp_rxq_info_user.c
> +++ b/samples/bpf/xdp_rxq_info_user.c
> @@ -233,11 +233,11 @@ static struct stats_record *alloc_stats_record(void)
>    int i;
> 
>    rec = malloc(sizeof(*rec));
> - memset(rec, 0, sizeof(*rec));
>    if (!rec) {
>    fprintf(stderr, "Mem alloc error\n");
>    exit(EXIT_FAIL_MEM);
>    }
> + memset(rec, 0, sizeof(*rec));
>    rec->rxq = alloc_record_per_rxq();
>    for (i = 0; i < nr_rxqs; i++)
>    rec->rxq[i].cpu = alloc_record_per_cpu();
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ