From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.216 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796025490; b=5jwD3PqIIgDPdhSyiV4vCBuaWBj5z+jJHo0BfzbvOwa1/I1+a+99fetFZQ6A4uSlcxv+ BoScZjlNaWUlU5fnq1FKqQBEIoYhsQ90vsfjtc89yMHdwjr1zT+VcFmqbcIP4gVMANVv2 0az/VGlFye+ENBYfvwQmjUKz41eKiP45UoX2sitaZ3enLKdlTdJCN4gEleZxePUiHv5m1 6O49fx5oTgb1reVSrtj/1Y/hpYoBQHSF+B3N9wAwsVBoH6Kh+P5LbILH1sA9j+9Nl5gdW bMaai5O24iDezDKIBZe5mw/mbDFyy24bsY8Ao87UI4G8cgfaXgIpTbPfzt14ZyThj2A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796025490; h=DMARC-Filter:dkim-signature:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Type:X-Originating-IP:X-ClientProxiedBy; bh=EkFeO+MHEkcjTaz29P5eRMYNgCzXdpGN2CxAi/vVoco=; b=UxtwKIuHi2WxHUDNmTKUwie7qJxR6vNrOj3MJFa28ck5PeHAv0XqbbDl+WQfqTAOiINy tcrkj6eAaIWBO0Cj1MPBDdJUbUnepw1TFnRjvAOPL5u5xy6B2XfzMbjMyXSeuTd3iir00 Wl9Zu456BpCnrnvqGn5OCCCpxrC+zXe67ZueAP7ews2pFFZHLLR2gbqpqGwoHRKO+9igL 7uE0ftFcQvweiw/4y3WXqydqauv/6Hy2D/zvrZ3eJKlKOe5EKsaaRyPW5ngDcavUZYJTZ RvcC+yUiZx3fOglbjz/fCkhB1MR1W7Hwi0Xp7+2YyvMjLSfHVjiMa5Mv1mK96JFzZnw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=pbvCNTgQ; arc=none smtp.remote-ip=113.46.200.216 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 33C72606A32D; Mon, 30 Nov 2026 07:58:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 33C72606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=pbvCNTgQ dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=EkFeO+MHEkcjTaz29P5eRMYNgCzXdpGN2CxAi/vVoco=; b=pbvCNTgQDJrwupZ2rivQp/ck7UZF3gRXaK7RhKedkReHXPINnzQCRSwiu7aniS4dU40pdFg6r 5Y1JxSohHjU/u69SVsJw7gRE+7N4CQ3sMZpNK+t8B8/ZzG4WXyuuhVg8Mthnwu9L544lhpMDQFR Tli//AaFBbdishzb+MT2iRA= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4jdGZR5Dcvz1T4fv; Mon, 30 Nov 2026 15:57:03 +0800 (CST) Received: from whupemk100010.china.huawei.com (unknown [7.152.184.41]) by mail.maildlp.com (Postfix) with ESMTPS id 8130A4056E; Mon, 30 Nov 2026 15:58:00 +0800 (CST) Received: from octopus.huawei.com (10.67.174.191) by whupemk100010.china.huawei.com (7.152.184.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.56; Mon, 30 Nov 2026 15:57:59 +0800 From: Cai Xinchen To: , , , , , , , , CC: , , , , Subject: [PATCH v4 2/8] lockdown: remove useless decrement operation Date: Mon, 30 Nov 2026 16:29:08 +0800 Message-ID: <20261130082914.129495-3-caixinchen1@huawei.com> X-Mailer: git-send-email 2.18.0.huawei.25 In-Reply-To: <20261130082914.129495-1-caixinchen1@huawei.com> References: <20261130082914.129495-1-caixinchen1@huawei.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: kwepems500002.china.huawei.com (7.221.188.17) To whupemk100010.china.huawei.com (7.152.184.41) From: Kalevi Kolttonen The length of the written state is only used to strip the trailing newline; it is never read afterwards, so decrementing it while stripping the newline serves no purpose. Drop the decrement, and with it the braces around the now single-statement if. No functional change. Tested-by: Guicai Ma Reviewed-by: Nicolas Bouchinet Signed-off-by: Kalevi Kolttonen --- security/lockdown/lockdown.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/security/lockdown/lockdown.c b/security/lockdown/lockdown.c index 263dcc80d839..8648508d49b2 100644 --- a/security/lockdown/lockdown.c +++ b/security/lockdown/lockdown.c @@ -130,10 +130,8 @@ static ssize_t lockdown_write(struct file *file, const char __user *buf, return PTR_ERR(state); len = strlen(state); - if (len && state[len-1] == '\n') { + if (len && state[len-1] == '\n') state[len-1] = '\0'; - len--; - } for (i = 0; i < ARRAY_SIZE(lockdown_levels); i++) { enum lockdown_reason level = lockdown_levels[i]; -- 2.18.0.huawei.25