From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f67.google.com (mail-wm1-f67.google.com [209.85.128.67]) (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 B88683EFD23 for ; Fri, 6 Feb 2026 13:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.67 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770385260; cv=none; b=F9g2zRxhiO6JYdodByLMa2hIrEbq2dwss7fnk6+imgDyhl4Wj2QANGXntJg1Wuf4g+Tv5wlsruKTNHukdRPPqqSytSj6J47R8DXqSv8PJpGdeadGq9+7tb9A8d0UYoFcC2wWpduQLWeRFbNBYoFoJZNex9NJKERJXoCnrB8pM/E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770385260; c=relaxed/simple; bh=tkIpRwBDYDdb/zCUYVv+On6clDAzHQr412pc0WKufOU=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; b=mP8cTnIZLesLCFtm/TUhqQg7n00Afa0N1ywfUMQFgF8rEP4wLMgtbDueIHQt5Ov8VRsAFzv1YLHJPpYFSeSpz/R/zDNoAtr1M0P9LwMpFi2n8eCljSkvh2SK6onVNt4Pz1XHwJ2Ce/5OAgdPIddzXpMIGPLlICzt8EG2hQpqN5Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=gaBiaGYp; arc=none smtp.client-ip=209.85.128.67 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="gaBiaGYp" Received: by mail-wm1-f67.google.com with SMTP id 5b1f17b1804b1-4801c2fae63so16978325e9.2 for ; Fri, 06 Feb 2026 05:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1770385258; x=1770990058; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=9jkkg9jFlFPGR2rYLRkmcbA2bDtDRDVG58fqHbGGve8=; b=gaBiaGYprOGVVKcSifZsBXZTVSHlzXDqSaZ5Tum7ZUhFHNNF03MRUQSXBYnIZotfDv U89zUzgaPiKpJ3Hqq9ZcykDbdH+CtBOM+BCXPcEuLfHs844Fi79esf7lIwkWBB+h32HV fBeDc6XJPHPAigyrkgOQctAGmmhIDrIGQS46aTPW7UrziR80iPmfONCP64CP93LFB7a3 Lb5DXkTJOyjdoeDx7v74wGW1Z/R6RsV/O0Yx1vpd/Mf8Shp8juqq5DqzYheifpaK7W9Z zaP9qtUaPMYVr4pfUdSOD1eC3gjjWBhBmfIej5i2ZTfl8D4cBt5S9N6iR4Fiki5wtZxf fz/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770385258; x=1770990058; h=in-reply-to:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9jkkg9jFlFPGR2rYLRkmcbA2bDtDRDVG58fqHbGGve8=; b=QHSdKkuBOcSsHuA3JuGyhJCNU6mUF34i4EWEroMKQYynbRV4M6IDih2Z54UPEHlqH2 HD9YxDidmDgrd+3FYPEFl5j1gQEm8Zm9uRFivMwU8kck6w9i3HGQ7iqZq14Hr0NaM+db 7UnSvy5AJe7WDDoz1/ek1xgWRa6UmcZFlBEp/C3SdHNkYvMped4u9CmuGFA37HNAZ+Nm EP0UyCoC76ya/KcwAKGbzhH9KIOSWRu1XzQTq3ysHE9Bj1O1oWzI5aLbMVGLMoH2mYXM WAxOkg3BeisPhUyRNWulM3LBksGczJBJjgpYrmHQxiWw2bv48a8nynd21k/7yPhIy2Y4 Mjpw== X-Forwarded-Encrypted: i=1; AJvYcCUzgzHDRDUUt2mq45hTwnNpcuhZGqJ3s9ITCXMOkJmRmfSNTJIrtSIoNjIjnyuwG2W28NavD08Ph4MT3DA=@vger.kernel.org X-Gm-Message-State: AOJu0YyDPYXP1sgHEqD38r/8TsOTX9kWOl00+jPwcNvs5WTm+NGCORn0 9HzEaxPQvOHp/OHsGzFnSdOnHAPueGtctC69bVUtNr4q1BGLoAN4rE930Q6MTmHettw= X-Gm-Gg: AZuq6aKjkENe0gwXB5NByd9dJr0aZ5rEFe0vLUEgcOAM9pmYSIugrNqNpX5q1zdddYX l+a5qTXw5unprNhZgSWYKeHgtKFAuEaJKBb5rCdf9zfMQ7v8XjsEnTHypogPp1G0EENrYOAoQYr GsrCS9nniZ2jjCU291Q6Xa8/SiQArQL7J19Tpc1PoRuijcqM+v/LTKKV3iM0L9RKYs5TAfM8JIi mhPVH5pUyaetM8vpvyhKX7G8w7QxRc7P0H2YxvYZWFDN36VofuCvKFwridfTX6AEaE6/RfOvXLc g/qadSpMNi61HV3hOVpvyzws8JpEC9F/LSoJ4Da/abAqZVoCyrxqWXyuu7FZxTi0yOD/c50dwFF xynWa50raEBaJStayKDH0j4Y7HaWU6hzttAwPutv/sPUc/oyD9WEvmF7/bDEFP0qpHNO6oDfi9i QjUtl14vOp4XShkWVA X-Received: by 2002:a05:600c:8b57:b0:479:35e7:a0e3 with SMTP id 5b1f17b1804b1-4832021d9b3mr42698745e9.30.1770385258133; Fri, 06 Feb 2026 05:40:58 -0800 (PST) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-48317d2bab2sm232209295e9.3.2026.02.06.05.40.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Feb 2026 05:40:57 -0800 (PST) Date: Fri, 6 Feb 2026 16:40:54 +0300 From: Dan Carpenter To: Miaoqian Lin Cc: Mathieu Desnoyers , linux-trace-kernel@vger.kernel.org, linux-kernel Subject: [bug report] tracing: Properly process error handling in event_hist_trigger_parse() Message-ID: 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=us-ascii Content-Disposition: inline In-Reply-To: [ Smatch checking is paused while we raise funding. #SadFace https://lore.kernel.org/all/aTaiGSbWZ9DJaGo7@stanley.mountain/ -dan ] Hello Miaoqian Lin, Commit 0550069cc25f ("tracing: Properly process error handling in event_hist_trigger_parse()") from Dec 11, 2025 (linux-next), leads to the following Smatch static checker warning: kernel/trace/trace_events_hist.c:6925 event_hist_trigger_parse() error: we previously assumed 'trigger_data' could be null (see line 6856) kernel/trace/trace_events_hist.c 6855 trigger_data = trigger_data_alloc(cmd_ops, cmd, param, hist_data); 6856 if (!trigger_data) { 6857 ret = -ENOMEM; 6858 goto out_free; trigger_data is NULL here. 6859 } 6860 6861 ret = event_trigger_set_filter(cmd_ops, file, filter, trigger_data); 6862 if (ret < 0) 6863 goto out_free; 6864 6865 if (remove) { 6866 if (!have_hist_trigger_match(trigger_data, file)) 6867 goto out_free; 6868 6869 if (hist_trigger_check_refs(trigger_data, file)) { 6870 ret = -EBUSY; 6871 goto out_free; 6872 } 6873 6874 event_trigger_unregister(cmd_ops, file, glob+1, trigger_data); 6875 se_name = trace_event_name(file->event_call); 6876 se = find_synth_event(se_name); 6877 if (se) 6878 se->ref--; 6879 ret = 0; 6880 goto out_free; 6881 } 6882 6883 if (existing_hist_update_only(glob, trigger_data, file)) 6884 goto out_free; 6885 6886 if (!get_named_trigger_data(trigger_data)) { 6887 6888 ret = create_actions(hist_data); 6889 if (ret) 6890 goto out_free; 6891 6892 if (has_hist_vars(hist_data) || hist_data->n_var_refs) { 6893 ret = save_hist_vars(hist_data); 6894 if (ret) 6895 goto out_free; 6896 } 6897 6898 ret = tracing_map_init(hist_data->map); 6899 if (ret) 6900 goto out_free; 6901 } 6902 6903 ret = event_trigger_register(cmd_ops, file, glob, trigger_data); 6904 if (ret < 0) 6905 goto out_free; 6906 6907 ret = hist_trigger_enable(trigger_data, file); 6908 if (ret) 6909 goto out_unreg; 6910 6911 se_name = trace_event_name(file->event_call); 6912 se = find_synth_event(se_name); 6913 if (se) 6914 se->ref++; 6915 out: 6916 if (ret == 0 && glob[0]) 6917 hist_err_clear(); 6918 6919 return ret; 6920 out_unreg: 6921 event_trigger_unregister(cmd_ops, file, glob+1, trigger_data); 6922 out_free: 6923 remove_hist_vars(hist_data); 6924 --> 6925 trigger_data_free(trigger_data); Originally this was kfree(trigger_data) so passing a NULL pointer was fine, but now it will crash. 6926 6927 destroy_hist_data(hist_data); 6928 goto out; 6929 } 6930 6931 static struct event_command trigger_hist_cmd = { 6932 .name = "hist", 6933 .trigger_type = ETT_EVENT_HIST, 6934 .flags = EVENT_CMD_FL_NEEDS_REC, 6935 .parse = event_hist_trigger_parse, regards, dan carpenter