From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4CDF3C27C65 for ; Mon, 10 Jun 2024 09:48:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mt+7w9HLZfv2lCNS0z3tlnvZPP4gaAAT/gf2u+LSyr8=; b=PRhMTlzBVMplil IHRQ2b48QPlUKmOcYt4sFYrHUbUkQBmV3Zb93lO2fZFTsA2HFijNCaWQe9ew6Zkku+NCIJEAQHGvp QPB2K7nANnI48ojKHuH0xLnGAHqXcYp9Tp7HJuI3Joh1tuirmkvFkh58Y+Dwap+9eGcZ+MaI+7Jwj qGi0bgAtJFSpU6Ci8Wjc9mcZocjKdWxNzpx24HR9FL+9EYeOluJcIpLqqZD924xjmrau6nDkRugH3 NmxcHGxqb3fZEOt6EfOp5nYfNsjBU+annhPhv3joNrjkkQGUsH6pFDKpcZyfIV+WUUM9ZVrRu9Bkj SkesWOBeT4dRL9IWg/oQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGbd3-00000004Vse-1JYx; Mon, 10 Jun 2024 09:47:53 +0000 Received: from galois.linutronix.de ([2a0a:51c0:0:12e:550::1]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sGbcw-00000004Vq0-2IMF for linux-arm-kernel@lists.infradead.org; Mon, 10 Jun 2024 09:47:50 +0000 From: Anna-Maria Behnsen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718012861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=niYe53zUpXvYd4fxzEQMt55McnLdwhYGnjG+n4GezzE=; b=M4gvTaGsbM16AqQsriJORCFrrntzmFgB8Is7s6pQ78LdU2HWRJRnFgJxndSudK0nAsmMMA eC3OH0V+NN2ciJDyT15zM0nQ0kG+03ziVyZQd/wORTSL78pHfA6TvqEkMNE+ES1Zi2OPWp 6s2ntQmR6fODt9phl6r9h1dL3Mx00bzYuPI2UF6jal0h0/vUt+wDfVtqr0VwoMFXg6MvKF I9QmXH/kQFmD3TrrLJa7Uj80PV3D+MnrPUz9SoITH9cDOIBfgPu5GOXz7ugt6jH5Qn+nMj 7vFP2a5m0ducqlIANeVRtoJARItHm1lyABCRE6tjX7uJzJg2nJxowA7nukiI6g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718012861; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=niYe53zUpXvYd4fxzEQMt55McnLdwhYGnjG+n4GezzE=; b=cnvu1XqAXICWboO3c93v5ayawLJHbfSxDolW8t5qb7iy4hCL0hPGYDFolliObaqLRClvQR xBnTmrTVpPL/VPBA== To: Phil Chang Cc: alix.wu@mediatek.com, angelogioacchino.delregno@collabora.com, frederic@kernel.org, jy.ho@mediatek.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, matthias.bgg@gmail.com, phil.chang@mediatek.com, tglx@linutronix.de Subject: Re: [PATCH v2] hrtimer: check hrtimer with a NULL function In-Reply-To: <20240607022614.22902-1-phil.chang@mediatek.com> References: <877cf2i56q.fsf@somnus> <20240607022614.22902-1-phil.chang@mediatek.com> Date: Mon, 10 Jun 2024 11:47:40 +0200 Message-ID: <87bk496seb.fsf@somnus> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240610_024746_755456_589B3B97 X-CRM114-Status: GOOD ( 15.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Phil Chang writes: > Since hrtimers do not allow a NULL function to be passed, > to prevent a kernel crash, return before adding the timer to a queue. You could point out in the commit message, where the kernel would crash when using a hrtimer with a NULL pointer as function pointer. And it shouldn't be a problem to use more than a single sentence for a commit message :) > Signed-off-by: Phil Chang > --- > kernel/time/hrtimer.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c > index 492c14aac642..d32c1afe59b3 100644 > --- a/kernel/time/hrtimer.c > +++ b/kernel/time/hrtimer.c > @@ -1285,6 +1285,9 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim, > struct hrtimer_clock_base *base; > unsigned long flags; > > + if (WARN_ON(!timer->function)) > + return; > + Please use a WARN_ON_ONCE() (as documented in Documentation/process/coding-style.rst) > /* > * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft > * match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard Thanks, Anna-Maria _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel