From nobody Sat Feb 7 20:47:53 2026 Received: from out-173.mta1.migadu.com (out-173.mta1.migadu.com [95.215.58.173]) (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 8801833C52C for ; Wed, 22 Oct 2025 12:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761136603; cv=none; b=JQeFuMQlLoXG7fwNViYZP1uiGoR3QijIycDw7XG8KQTHZBQu6IYGMiZtVUzAOIFhRK79v9n9qyop3iz0BA72VkeM5khkpMsm9wF40ysGJp6SXMa7iUmPzK1GK0mknFYX20nv4KOJayC9t//sCia0hWZaOdAKr6NI6HXR0M/kEKU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1761136603; c=relaxed/simple; bh=G6/4RV+/hyEImD5Tjx7E3DcexAe5ffRKGf9PUm2hzkc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=EI9eQSr6t65WP9OoL5OILLqceVZd75YXkX1HZWGWTSkU0mDXh/ixhQV3tpMi0GPLnxqAsgQf98WdmFkoQglc1BN/TwJdzQz5lGNgOzwbW50peRwJxHFhaWgD0IqSb7gA3RLLe/aDYc/QNUQ+MC92FdBjrf2aPADL8Xpz2E3ulLI= 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=wghXhO4Y; arc=none smtp.client-ip=95.215.58.173 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="wghXhO4Y" 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=1761136598; 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; bh=tpFUwbpm7eC7NH+fV3rtn/zOowNizHjNm0vznqUq8k4=; b=wghXhO4YXwSNLlDCbffYanV3ZiR+drLtyTrMd/PkNWWvsZUF6RYtRqISyK29M5P3s5tLJY Ur854kMJ9PkWCQkZ+j/LELgfaGM573/TfssaLaIGFFKLOwVgsvbOLYV46zHZQTyvbfAx8W g8mlpp384LfIkJNlrIkUkkUx9WRXhus= From: Thorsten Blum To: Giovanni Cabiddu , Herbert Xu , "David S. Miller" , Andy Shevchenko , Jack Xu , Suman Kumar Chakraborty , Qianfeng Rong Cc: Thorsten Blum , qat-linux@intel.com, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: qat - use strscpy_pad to simplify buffer initialization Date: Wed, 22 Oct 2025 14:36:19 +0200 Message-ID: <20251022123622.349544-1-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Migadu-Flow: FLOW_OUT Content-Type: text/plain; charset="utf-8" Use strscpy_pad() to copy the string and zero-pad the destination buffer in a single step instead of zero-initializing the buffer first and then immediately overwriting it using strscpy(). Replace the magic number 16 with sizeof(buf) and remove the redundant parentheses around kstrtoul() while we're at it. Signed-off-by: Thorsten Blum --- drivers/crypto/intel/qat/qat_common/qat_uclo.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/intel/qat/qat_common/qat_uclo.c b/drivers/crypt= o/intel/qat/qat_common/qat_uclo.c index 18c3e4416dc5..41a7bd434e97 100644 --- a/drivers/crypto/intel/qat/qat_common/qat_uclo.c +++ b/drivers/crypto/intel/qat/qat_common/qat_uclo.c @@ -200,18 +200,18 @@ qat_uclo_cleanup_batch_init_list(struct icp_qat_fw_lo= ader_handle *handle, =20 static int qat_uclo_parse_num(char *str, unsigned int *num) { - char buf[16] =3D {0}; + char buf[16] =3D {}; unsigned long ae =3D 0; int i; =20 - strscpy(buf, str, sizeof(buf)); - for (i =3D 0; i < 16; i++) { + strscpy_pad(buf, str); + for (i =3D 0; i < sizeof(buf); i++) { if (!isdigit(buf[i])) { buf[i] =3D '\0'; break; } } - if ((kstrtoul(buf, 10, &ae))) + if (kstrtoul(buf, 10, &ae)) return -EFAULT; =20 *num =3D (unsigned int)ae; --=20 2.51.0