From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-174.mta0.migadu.com (out-174.mta0.migadu.com [91.218.175.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9127F46A609 for ; Tue, 21 Jul 2026 15:54:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784649271; cv=none; b=u6H6GMeM6JSBJu140MfD4OEoXfAOmAuHW7V+bKlvHRDrmyZn3boOptaymTJYUGS3zX222IRkqMxBru50OgLytk3W2Ejcwwi+hBMgpb9SAGyfbazoSReHFabHTwkV56YUDf6fy7UaMH5qm+qvd7auqyzZOk0QtfYpfFRTfDZOjTY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784649271; c=relaxed/simple; bh=zRRNcErEeZUzqUVDgfD4he8/ABa1ClK+vt73aKmxWDM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fPH+JANaairP1Zvpuh+UwxDpOZBmsmgBbkgmtnO8CAxuNpmcI6Wm1DRoIPAMqPcWtO6TgFZDJJ2EEXPDc6mZ4SVLj2l8ZPoqU3t/0a4zKn2LmvIhYVcGuaPCMoyflsdYWKggOE1RIrI22KwqRBqIE6mvViJN4BYcIdMwtf4T7aA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=A+r3IduV; arc=none smtp.client-ip=91.218.175.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="A+r3IduV" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1784649266; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=VzIcHGjxX1dcSz7+14+ettkC++8S0LxutXTYkBjO25k=; b=A+r3IduVgZBI+mzurlk1ToEay9DLcu22/XqjU/lVT3HfeuI3S2UOcU+SBGDB3kusfHjxrF BJfNmxcz/yGCaOB7KNyPpTsVhQYgp2jksqynj+faUwWj8p+vA+njE4F+0jekBkw8VqJVhn 9fZJjDEJgJ59jeSbsSsXBX7V0910U6A= From: Thorsten Blum To: Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , "Christophe Leroy (CS GROUP)" , Kees Cook Cc: Thorsten Blum , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] powerpc/pseries: Avoid strlen() in do_{remove,update}_property() Date: Tue, 21 Jul 2026 17:53:46 +0200 Message-ID: <20260721155346.121975-4-thorsten.blum@linux.dev> In-Reply-To: <20260721155346.121975-3-thorsten.blum@linux.dev> References: <20260721155346.121975-3-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=975; i=thorsten.blum@linux.dev; h=from:subject; bh=zRRNcErEeZUzqUVDgfD4he8/ABa1ClK+vt73aKmxWDM=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFnx06R9WOqmbz76eqVjw4Tc9XOfam7Yn2TXdqxNoFbir 3FZweLMjlIWBjEuBlkxRZYHs37M8C2tqdxkErETZg4rE8gQBi5OAZjImQsM/5MLGee93JzTcWIG x9YFzFPeWekqNO92YTXdwqm8XvrL42cM/6t7o5Jsff6y1V5k2DuBy3iFpaOKBsvaJ3sUHjJ8/Ln RjQEA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Check only the first byte instead of scanning the entire string with strlen(). Signed-off-by: Thorsten Blum --- arch/powerpc/platforms/pseries/reconfig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c index 7faebcffc9df..18e3f1a036e3 100644 --- a/arch/powerpc/platforms/pseries/reconfig.c +++ b/arch/powerpc/platforms/pseries/reconfig.c @@ -307,7 +307,7 @@ static int do_remove_property(char *buf, size_t bufsize) if (tmp) *tmp = '\0'; - if (strlen(buf) == 0) + if (*buf == '\0') return -EINVAL; return of_remove_property(np, of_find_property(np, buf, NULL)); @@ -330,7 +330,7 @@ static int do_update_property(char *buf, size_t bufsize) if (!next_prop) return -EINVAL; - if (!strlen(name)) + if (*name == '\0') return -ENODEV; newprop = new_property(name, length, value, NULL);