From nobody Thu Sep 18 15:37:45 2025 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 6246DC4321E for ; Mon, 5 Dec 2022 11:36:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbiLELgs (ORCPT ); Mon, 5 Dec 2022 06:36:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229970AbiLELgp (ORCPT ); Mon, 5 Dec 2022 06:36:45 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [183.62.165.209]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2891A19299 for ; Mon, 5 Dec 2022 03:36:45 -0800 (PST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NQhMv42LCz4xpy7; Mon, 5 Dec 2022 19:36:43 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl1.zte.com.cn with SMTP id 2B5BaaYY051373; Mon, 5 Dec 2022 19:36:36 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Mon, 5 Dec 2022 19:36:40 +0800 (CST) Date: Mon, 5 Dec 2022 19:36:40 +0800 (CST) X-Zmail-TransId: 2b04638dd7c8ffffffffa569f048 X-Mailer: Zmail v1.0 Message-ID: <202212051936400309332@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIGlwbWkvd2F0Y2hkb2c6IHVzZSBzdHJzY3B5KCkgdG8gaW5zdGVhZCBvZiBzdHJuY3B5KCk=?= X-MAIL: mse-fl1.zte.com.cn 2B5BaaYY051373 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.13.novalocal with ID 638DD7CB.000 by FangMail milter! X-FangMail-Envelope: 1670240203/4NQhMv42LCz4xpy7/638DD7CB.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 638DD7CB.000/4NQhMv42LCz4xpy7 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Xu Panda The implementation of strscpy() is more robust and safer. That's now the recommended way to copy NUL terminated strings. Signed-off-by: Xu Panda Signed-off-by: Yang Yang --- drivers/char/ipmi/ipmi_watchdog.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_wat= chdog.c index 47365150e431..0d4a8dcacfd4 100644 --- a/drivers/char/ipmi/ipmi_watchdog.c +++ b/drivers/char/ipmi/ipmi_watchdog.c @@ -213,8 +213,7 @@ static int set_param_str(const char *val, const struct = kernel_param *kp) char valcp[16]; char *s; - strncpy(valcp, val, 15); - valcp[15] =3D '\0'; + strscpy(valcp, val, 16); s =3D strstrip(valcp); --=20 2.15.2