From nobody Fri Jun 19 08:34:03 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C17DEC433F5 for ; Wed, 6 Apr 2022 13:04:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229802AbiDFNG0 (ORCPT ); Wed, 6 Apr 2022 09:06:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231965AbiDFNGP (ORCPT ); Wed, 6 Apr 2022 09:06:15 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B456F41D681 for ; Tue, 5 Apr 2022 18:47:19 -0700 (PDT) Received: from kwepemi500012.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4KY6lx3K12zgYPh; Wed, 6 Apr 2022 09:45:33 +0800 (CST) Received: from huawei.com (10.67.174.53) by kwepemi500012.china.huawei.com (7.221.188.12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 6 Apr 2022 09:47:17 +0800 From: Liao Chang To: , , , , , , , , CC: , , , Subject: [PATCH] sched: Fix pointless comparison between unsigned int with zero Date: Wed, 6 Apr 2022 09:46:28 +0800 Message-ID: <20220406014628.172539-1-liaochang1@huawei.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.67.174.53] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemi500012.china.huawei.com (7.221.188.12) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" It is pointless to do a comparison bewteen unsigned variable and zero, since validation routine requires the MSB of sysctl_sched_rt_period_ms is 0, so casting variable to signed value before comparing with zero. Signed-off-by: Liao Chang --- kernel/sched/rt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 7b4f4fbbb404..58e105180e67 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -2906,7 +2906,7 @@ static int sched_rt_global_constraints(void) =20 static int sched_rt_global_validate(void) { - if (sysctl_sched_rt_period <=3D 0) + if ((int)sysctl_sched_rt_period <=3D 0) return -EINVAL; =20 if ((sysctl_sched_rt_runtime !=3D RUNTIME_INF) && --=20 2.17.1