Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp819491ybg; Fri, 12 Jun 2020 16:00:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwWZmBAVi0Z8TMTuA7ofbtbXCEKEG/ETR5oan3dlZSGumKR+zRp6cRNTBsmDjz1FKttEwWx X-Received: by 2002:a17:906:22cc:: with SMTP id q12mr16003300eja.485.1592002827671; Fri, 12 Jun 2020 16:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592002827; cv=none; d=google.com; s=arc-20160816; b=G7A+RZ6nfBSc1eAtX/xyi/8ZfvPbuXFhIjdWGV7AExyVf8yTBTPMYuFs0tLR4J6gfh f2hOzbs0wDUMKcQjonxAsjZ4yYnjhjTYPKgiZrLCluWG6RDagI+xurZaNl0wfYjLKyTw KhZRxoW8B/sx59N8E9Yy+di3/fjDwxBNx0gSo/Z8jF32KsBDwZfAFYu1behmEoVPqp+6 Hdq5/4+I1Qc0TwjuYUoS9TI7vY7Bv73YySB74VgLfs+rCateAgSXKPfCTTnlNwJ5h6ym NiSkGtZ3Hj/nFTBkt297Up+yyA5CGM5SLBfw5IfME5Sm6srbnOJBu6r6iIULhCnMeDlz /4Rw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :subject:references:in-reply-to:message-id:cc:to:from:date :dkim-signature; bh=WF0yayqOy4vitr2gfwwxeEUgwqbRugYbv4Z4Yh4JOl4=; b=NKhZWcTgBIAKb1kdoE6pfJFwZabyRZzh9uvYlH3t2oYOdGUiL0BZrA8FCM+nLry5i9 qDD9RK2Hm4GW1vsdqTVwNzTxzoFwWAIlynd2WdESCyXHaPwpdmx+58gjxwL119O/w5dh qywvn8/3FtGA9VdqjAcJceQeRSq4H7EDgnVO25Pi3+x7fnjVWvtW6mc5IfoggnPzkmSg EoY4tR2nHkR6A2k2xkj3TwuZ1o9B7w3pmUeCqVo1CA9aBOV4zQkl0n9o2bkLZ/5xTAoV e7ppMzukc5CidyooKcQ4GzYCSXWDwXCkgjJxSdQXgRBr4r9CRcRuFM9oCnRSGag6fbL5 Ixsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EbllFoiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m14si5029619eja.139.2020.06.12.16.00.03; Fri, 12 Jun 2020 16:00:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=EbllFoiE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726353AbgFLW6R (ORCPT + 99 others); Fri, 12 Jun 2020 18:58:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726268AbgFLW6Q (ORCPT ); Fri, 12 Jun 2020 18:58:16 -0400 Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7CF78C03E96F; Fri, 12 Jun 2020 15:58:15 -0700 (PDT) Received: by mail-pf1-x443.google.com with SMTP id x207so4995551pfc.5; Fri, 12 Jun 2020 15:58:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:message-id:in-reply-to:references:subject :mime-version:content-transfer-encoding; bh=WF0yayqOy4vitr2gfwwxeEUgwqbRugYbv4Z4Yh4JOl4=; b=EbllFoiElAHgOlHuOBsYnZw3EV7nEKET3GVw8VLabZnhR2G5qwcm0KpbXCS434NAa+ prl7pJAzOJYbKBfeY5NHA4NGBO7fRO6meV9DbBaN5L059YmK8OvR0DlWNvob/0F3uJrz APW0jeuNj1Dq4kjUj67nX37v6b5fvtNNxxk7QaXVksRLTC6b3KCQZn4VvIiUe7o2oWe9 GkYaMJMu/iyET+WA+/95mWHdbrAREXX56i3M0hQB9mbL7EiRhLcKAhMI+/UnFb1aNZsO EYr+z7PPwsfmu3ei8mwfam4SaB/eRDevBVPQtoDiv8JAuomvFvFof5u4OJHK8Qb1tgWa KxTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to :references:subject:mime-version:content-transfer-encoding; bh=WF0yayqOy4vitr2gfwwxeEUgwqbRugYbv4Z4Yh4JOl4=; b=F6gFlu6oVa4hFSxS228BsHYqSp75IlSbXL3xO2IzKDkyE0f2sXg99LqkM//jJeah+D mAU0kWIU5b/BkjPpcHo6YTqINE9ESB4OTrevVxLVPvCxx12HN9Cc+AZBekbbFT4G+vVa vNHwO+XI/U5+2mLFb0rQxJV5AqwRjn7HqzntvrE/uxk74ZAsVk86TYw//cyXAhzh3Pig +pVfYtMSVYVPAK//kN3aRNy3ng9+/G2YvkThVfQRoaymD918F/lg5TP34VyjiaqsPSOx WYslREfaw6CM/LLCE7WYBOzjxb/z5/U822VD5YaQe4JYfLw2156Ve5NHmmOu8r7U6vpI G9YQ== X-Gm-Message-State: AOAM532FtXLbvlq69VG2Hl9XWC28gydvw3hB66Wg+HnJIXgMScaJBW+0 aoYowjB8d78GE2W8b06VUSE= X-Received: by 2002:a62:3381:: with SMTP id z123mr14095536pfz.274.1592002695001; Fri, 12 Jun 2020 15:58:15 -0700 (PDT) Received: from localhost ([184.63.162.180]) by smtp.gmail.com with ESMTPSA id y5sm6092183pgl.85.2020.06.12.15.58.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Jun 2020 15:58:13 -0700 (PDT) Date: Fri, 12 Jun 2020 15:58:06 -0700 From: John Fastabend To: Jesper Dangaard Brouer , Gaurav Singh Cc: brouer@redhat.com, Alexei Starovoitov , Daniel Borkmann , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , John Fastabend , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , KP Singh , "(open list:XDP \\(eXpress Data Path\\))" , bpf@vger.kernel.org (open list:XDP \(eXpress Data Path\)), "(open list:XDP \\(eXpress Data Path\\) open list)" Message-ID: <5ee4087e2b5a_489d2af902f845b4b7@john-XPS-13-9370.notmuch> In-Reply-To: <20200612222031.515d5338@carbon> References: <20200611150221.15665-1-gaurav1086@gmail.com> <20200612185328.4671-1-gaurav1086@gmail.com> <20200612222031.515d5338@carbon> Subject: Re: [PATCH] xdp_rxq_info_user: Fix null pointer dereference. Replace malloc/memset with calloc. Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jesper Dangaard Brouer wrote: > On Fri, 12 Jun 2020 14:53:27 -0400 > Gaurav Singh wrote: > > > Memset on the pointer right after malloc can cause a > > null pointer deference if it failed to allocate memory. > > A simple fix is to replace malloc/memset with a calloc() > > > > Fixes: 0fca931a6f21 ("samples/bpf: program demonstrating access to xdp_rxq_info") > > Signed-off-by: Gaurav Singh > > Acked-by: Jesper Dangaard Brouer > Acked-by: John Fastabend