Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1233243lqb; Sat, 25 May 2024 11:22:24 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVQIw0f9ZRNiKNagUlhsnv2fnFT8n0Tb5Zo6IQn6wifHr7gK4B6SFf60qr6AJ+WnRdUA0SkRumSnTRkgiP1b3AGuZchBQy04sPjVF5/sw== X-Google-Smtp-Source: AGHT+IEAbCqnIASDhaZCNXmstmnK2Gh35AhDTBwdVosJ7FeF66adr3a+VQu+2IzxKvJVd9BDdwa5 X-Received: by 2002:a19:6442:0:b0:518:ce4b:17ef with SMTP id 2adb3069b0e04-52966ca838amr2605027e87.60.1716661344775; Sat, 25 May 2024 11:22:24 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716661344; cv=pass; d=google.com; s=arc-20160816; b=X+AO7eJP4ztPMntz4rlDAjQP1k4NkbsJ/QxNRh0kme8EV+383LnHgEtKSmxlsSYCf1 1x7ELE5CrZgFTDJkYEdDjqXwoiCXxAcEbh24s8PnYwR35F/IjicpstHSBJa1kdURr0RW EWl5Ruv183lr+zqgWfipssi2l7DuUdJ2gd/Y+PN59KnT6ZW+NXhY225QNm1rasZOQ0XJ OPgnsSVubviwaUTDbY5rjGEtaR76K/0HhLXwOKJmRFvL46GczPa1EJz/Lg5j97kvi754 G7l0+KIlXIa6F+qsVaZM5xJ0PDuC0/KUurlSU3bTHhiiRwcwrPhM0sIvNYnN38iYq1d3 ymIg== 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:dkim-signature:dkim-signature:dkim-signature; bh=m8k3YJ6Pa5+fRRrELod8+uIM03/stiCjVD21MeOxwQs=; fh=1rVzyP1vcxIIwZAlUBawXS3FbYGyxQ2hnhPwkO4TiBc=; b=Wo8zm9vzlDUqTuvkHMenrU87BPDO02YUmQdzX+U3G2ymJ4S26J2Xvk0Kb8mW+Eom2X Q7te75N5YqQZ6HqijhaFWNbRwZ3E2tDZDheCDnzM5EnBtMB8ng6JP2A10qF6sHqaS3Og y2nLfAoWMegEJyh+e7Znghc873TBkFrGgUwI5EKSaKDdJKoIO/Hbo8+awEnRXDVcn78S 6fYdqyVqW5M+olsV3d9or1oah4pCKjhJAmzBKP04F+IGVwy1oypnZrvWcD+T9J7F8sYN tasxC1XalLntm1D5mvuUGu/Slm7iqBBXcE0oI613l0AHr+5eM4D4A72Vd5/qx1SxN32O XsMQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B4BkDQGf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B4BkDQGf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-189507-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189507-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a626c80060csi201238566b.176.2024.05.25.11.22.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 May 2024 11:22:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189507-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B4BkDQGf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=B4BkDQGf; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-189507-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189507-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 4D9991F21582 for ; Sat, 25 May 2024 18:22:24 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C590A127B51; Sat, 25 May 2024 18:22:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="B4BkDQGf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="10UCqdOY"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="B4BkDQGf"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="10UCqdOY" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 632011CF8F; Sat, 25 May 2024 18:22:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716661334; cv=none; b=guWHh5+ehCMNPZmgU42qfrsrGSuczCri/LQ/E86s9Q2U54+AZXw7h8+/9NCrkgZI11jBdT/PK34ufYHnSkXLdLjibW+crRtDzH89jiiqRUOiOA/vnsI3K5JzeaREDWTcygdbWLpLqeeN/MAqcTMa9B8BAXdJ+MuBGBkdGeNWYEE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716661334; c=relaxed/simple; bh=k/iX0RaIP3m97XishbvBAFhhUj0SK/I4pjIxMOIgjEE=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=j7jKvhbcLdtjqDnvnX4h4kDh1yXbgRgcRkh7xPazWY/lJpT0/ssJTx20fmKpOXnODaEg7J8DUwm4p/hCtNDYOLI3+OPbBCKHmsg9RLTLcymMbkZv+6OVknzGMQZBcWCvwrGc/IKsEwV50IH505+snv+UV1qSrmYSifx20qaG87M= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=B4BkDQGf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=10UCqdOY; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=B4BkDQGf; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=10UCqdOY; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 94B235C277; Sat, 25 May 2024 18:22:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716661331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8k3YJ6Pa5+fRRrELod8+uIM03/stiCjVD21MeOxwQs=; b=B4BkDQGf0rCTeARCz0UkQTcGjf3OPQjySDDjBszbhFlo37z7KB8cze6xp3xez0fVf1vlFx BERhWCTXF5H8Ju23n80kQsQLyxsyDVy7TdSpRDpFaQ0qrFOjC9dN8a2XBdJ7AqqCjhWqGl wHRRSuRcRTDCazbstSmXbitD61SG0uM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716661331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8k3YJ6Pa5+fRRrELod8+uIM03/stiCjVD21MeOxwQs=; b=10UCqdOY0AAmOSPKOXTYmNHS7ZqvWkxg2MB5s1+a0XQHQyiyHvwpqwca+YwIush5VvlhZd Edq3wmjBkGKz/CAw== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=B4BkDQGf; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=10UCqdOY DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1716661331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8k3YJ6Pa5+fRRrELod8+uIM03/stiCjVD21MeOxwQs=; b=B4BkDQGf0rCTeARCz0UkQTcGjf3OPQjySDDjBszbhFlo37z7KB8cze6xp3xez0fVf1vlFx BERhWCTXF5H8Ju23n80kQsQLyxsyDVy7TdSpRDpFaQ0qrFOjC9dN8a2XBdJ7AqqCjhWqGl wHRRSuRcRTDCazbstSmXbitD61SG0uM= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1716661331; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=m8k3YJ6Pa5+fRRrELod8+uIM03/stiCjVD21MeOxwQs=; b=10UCqdOY0AAmOSPKOXTYmNHS7ZqvWkxg2MB5s1+a0XQHQyiyHvwpqwca+YwIush5VvlhZd Edq3wmjBkGKz/CAw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id F2BD813A6C; Sat, 25 May 2024 18:22:10 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id V7oMOFIsUmYhTQAAD6G6ig (envelope-from ); Sat, 25 May 2024 18:22:10 +0000 From: =?UTF-8?q?Carlos=20L=C3=B3pez?= To: linux-trace-kernel@vger.kernel.org Cc: =?UTF-8?q?Carlos=20L=C3=B3pez?= , Steven Rostedt , Masami Hiramatsu , Mathieu Desnoyers , Alan Maguire , linux-kernel@vger.kernel.org (open list:TRACING) Subject: [PATCH] tracing/probes: fix error check in parse_btf_field() Date: Sat, 25 May 2024 20:21:32 +0200 Message-Id: <20240525182131.15740-1-clopez@suse.de> X-Mailer: git-send-email 2.35.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Level: X-Spamd-Result: default: False [-1.13 / 50.00]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; BAYES_HAM(-0.62)[82.14%]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCVD_VIA_SMTP_AUTH(0.00)[]; MIME_TRACE(0.00)[0:+]; ARC_NA(0.00)[]; TO_DN_SOME(0.00)[]; RCPT_COUNT_SEVEN(0.00)[7]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; RCVD_COUNT_TWO(0.00)[2]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim,suse.de:email,imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Queue-Id: 94B235C277 X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Flag: NO X-Spam-Score: -1.13 btf_find_struct_member() might return NULL or an error via the ERR_PTR() macro. However, its caller in parse_btf_field() only checks for the NULL condition. Fix this by using IS_ERR() and returning the error up the stack. Fixes: c440adfbe3025 ("tracing/probes: Support BTF based data structure field access") Signed-off-by: Carlos López --- kernel/trace/trace_probe.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/trace/trace_probe.c b/kernel/trace/trace_probe.c index 5e263c141574..5417e9712157 100644 --- a/kernel/trace/trace_probe.c +++ b/kernel/trace/trace_probe.c @@ -554,6 +554,8 @@ static int parse_btf_field(char *fieldname, const struct btf_type *type, anon_offs = 0; field = btf_find_struct_member(ctx->btf, type, fieldname, &anon_offs); + if (IS_ERR(field)) + return PTR_ERR(field); if (!field) { trace_probe_log_err(ctx->offset, NO_BTF_FIELD); return -ENOENT; -- 2.35.3