Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp385347lqo; Fri, 10 May 2024 02:58:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWvJ5cGTQhHY/bJuqVY1mqEiNbNlTS6mYhMNLzdteCkMX8S3uf8UP2CyO8WTYH2NGjmMX0+N3ZfY0oiBV3Z8W6FyKKqzhFsPy1FQazMSQ== X-Google-Smtp-Source: AGHT+IFkofOxoUAbomAGLx1dzafH3hGX9eWsOqvCqEAxyQai3ojH+RIhM16OnjS54OopyZihqixt X-Received: by 2002:a17:906:474e:b0:a59:c52b:993c with SMTP id a640c23a62f3a-a5a2d676c02mr110077666b.77.1715335126809; Fri, 10 May 2024 02:58:46 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715335126; cv=pass; d=google.com; s=arc-20160816; b=I62PHsE5wz1f9cbCBCu3vqueLDJkoeYnn4tnPmgPoCT/7V5WCkgEcddbF3g961fBCn wBzKEwD8vkWGAEgRI9IhLHKSd490BPcbq5z10lizfMQNpQfVs/wE4+FlNHswGYuBcMDW 2E2TMdK8tklIr9Tq6FTmMFSMEVw7YKT0BEeXonHEjWLlSSf39MhZbx4bS6cyK8UbauQB 7+GGGik95FxG05r2vk2uGBclWKv4lVnRsssV3xisx63p3T3/utIIZAUejJYWcdQd5bnC u7uUPIQ1WI697vSHR5D+99rCk5r0sKTa2RhAVnWBCLNcFg+HsPfDiYtwGirAXlZwYAvm xgVg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=ynoBbmu7uH9JiLyBHsFJi2Dy06OCsFnk/vBceNe8s+w=; fh=lPKFJvVb52pC2FZAsmTs3X0iL2A14rZznWkIdxXku7w=; b=cX8/D1m3uBcKczwReAq6aBFTZmjhdBzollDws3P4/pEoafbG7XNWnST7N50V69y6jL IA5D8E87SMKiLuQwQG72XPeA9QTYcV/vzYQUVQC/lf5FsBZimhO5rmGd3WxSEHGbBLWm z6s/JxsqZL1hPager+sAyE3gAR7PIM84xu4o4VvniQxF/kPjyUOuUSVxNoEuzFHGrK56 BQVwGHKt/SrE1HX0AgY5O0sX+gVfnux8AKu7T7n0nwMmBtFbdstvEPvEDaWA73AdCQdu W419ZnTdLdbhlTizjvk3H2tgEuwXfDTAAh5jPm+HN6F2yP+U+5cMc1hrfkbo0Mx/ao8D 4WhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Km3nXF/p"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-175556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a179463basi169249266b.126.2024.05.10.02.58.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 May 2024 02:58:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-175556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Km3nXF/p"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-175556-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-175556-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 87B6B1F21920 for ; Fri, 10 May 2024 09:58:46 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65578168AF6; Fri, 10 May 2024 09:58:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Km3nXF/p" Received: from out-176.mta0.migadu.com (out-176.mta0.migadu.com [91.218.175.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED7AB1649CF for ; Fri, 10 May 2024 09:58:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.176 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715335101; cv=none; b=iDpi6Nfo6LnKoslCIpc/AlrqL6pAVaqkhn6Or9wKuDUOtavxLZCBOJ4kzDM5LYC35eiSMLBEf2BYLCQ59AryGNpv7Tt3UI5DW4DrcaQvF6gvnXEjdo7ZT3k1qAobSa6PWgo1Ej5QzDH7RDoF8JnoRMvj6/LF8wiW3qNz5pCdngk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715335101; c=relaxed/simple; bh=dc5X+/qSmxzC1WnaveQ9yTUgWMgYD6IWrs8np6LgqgE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=B69LSiSpViuL+Z5OtvMAyKwnjiU/o/xSVjIUmqW5UdP4vR0tx0/Rl3XGc5B9ZjzG9gMRlFhx1o0oTaltbdKBU+YDOB0wcqQXRg6eQhGn8U/tVJf+40NQ8TQ9Ot1PaxDUif92UsdGbpdafYKRB7Pe2O4yLwDIVR0MOX/SB62iNn0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Km3nXF/p; arc=none smtp.client-ip=91.218.175.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715335098; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=ynoBbmu7uH9JiLyBHsFJi2Dy06OCsFnk/vBceNe8s+w=; b=Km3nXF/pgC8IMHmoffiLh6DSKVfMWUCuqK7iHRQ+Xj/El0URwTxSOjXITmULoRHkq2/1+Z NnvONNnHO9NNY/ZyNj2E66iFs9FXmq8+dQUacyAx3kZAnDdRgkNzPUp1IumpyG3ekdeshN 3kaEfEYN0RlAX/xEw29iOMjuHbxIzlM= From: kunwu.chan@linux.dev To: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, eddyz87@gmail.com, song@kernel.org, yonghong.song@linux.dev, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, mykolal@fb.com, shuah@kernel.org, kunwu.chan@hotmail.com Cc: bpf@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, Kunwu Chan Subject: [PATCH bpf-next v2 0/4] Add some 'malloc' failure checks Date: Fri, 10 May 2024 17:57:59 +0800 Message-Id: <20240510095803.472840-1-kunwu.chan@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT From: Kunwu Chan The "malloc" call may not be successful.Add the malloc failure checking to avoid possible null dereference. Changes since v1 [1]: - As Daniel Borkmann suggested, change patch 4/4 only - Other 3 patches no changes. [1] https://lore.kernel.org/all/20240424020444.2375773-1-chentao@kylinos.cn/ Kunwu Chan (4): selftests/bpf: Add some null pointer checks selftests/bpf/sockopt: Add a null pointer check for the run_test selftests/bpf: Add a null pointer check for the load_btf_spec selftests/bpf: Add a null pointer check for the serial_test_tp_attach_query tools/testing/selftests/bpf/prog_tests/sockopt.c | 6 ++++++ tools/testing/selftests/bpf/prog_tests/tp_attach_query.c | 3 +++ tools/testing/selftests/bpf/test_progs.c | 7 +++++++ tools/testing/selftests/bpf/test_verifier.c | 2 ++ 4 files changed, 18 insertions(+) -- 2.40.1