Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp1687502rwl; Mon, 26 Dec 2022 03:18:43 -0800 (PST) X-Google-Smtp-Source: AMrXdXsnSTJRl/9/xkVMpn/pxlqAxiDCIu/mj34ky21/JIzIsyzbyHdNrsmyNDbYcMxupJ+vlkc4 X-Received: by 2002:a05:6402:351:b0:461:bf47:ba43 with SMTP id r17-20020a056402035100b00461bf47ba43mr19421185edw.28.1672053523205; Mon, 26 Dec 2022 03:18:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672053523; cv=none; d=google.com; s=arc-20160816; b=eAG+jB1EtDxk2LHJ11mLW/2uJ7MGhYf8JzZX91DTo2cpSLnqP/7+hNHsVXwFecvBoV WZjvoQmrXx1H6/cil5dQlbiVQQ2/FLZ0Fg+59BOKizBhJL+CHpOiPtQLdlZTEAymuv9r mXvMf7VC08GnvYEMKOUFjQyh1FRBxACV7yaQtqb9S0kSEWFms3Rfwrs/ygMjyfmPPhZD sUt3dTSt5ylyYmq3qoRRjApmPhlykcfdnjDBqTK56hMKaaEHlYXIZEv+Iru7hiDSxcn0 xIrobUxidG7Jdrk12YiprBOFXimIjYNjKzaErm5H8J0TNLPd/LW2E75UZaY9mfQG3BBz qVXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=hpNNG4N5adjc3PqVK73NWPe6Mirzd2F4gLdW1yjjGUE=; b=Ty42SuxPkSP7MYvpcEz+WvzZd2BRF9+1IixV8Prh2oznKBt40UdsYV+iQpfkgJqAIj Z9agVB0RPKN3HdRFW8BuQXNz1r7yWGn/Hc0Oq66K7Bv4m+s6ma9R+JdXDPazHDk8IP+c rKuFWsf37lYDeEvNYEU1fBFQPFHCd0qYs4WC0n7o3U8yrTJ7FQ5Wgm53Wfibh+mzLIuV WvfIZ482QzU8v9Ju1k66CLS7qKzYueCFPmDqR6hXxvNQ27TnzKugGMUP0xq+TtcqT4Hj brzMjf7g90g8Iim9RVyrSP8AB4+yT9OHyBkwOvoCeY39hWtktRrFmMfVxOMnCOkXu37d +KNQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i18-20020a05640242d200b0047f2b102941si10596605edc.361.2022.12.26.03.18.27; Mon, 26 Dec 2022 03:18:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231909AbiLZLCD (ORCPT + 66 others); Mon, 26 Dec 2022 06:02:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231777AbiLZLCB (ORCPT ); Mon, 26 Dec 2022 06:02:01 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23FC2111A; Mon, 26 Dec 2022 03:02:00 -0800 (PST) Received: from mse-fl2.zte.com.cn (unknown [10.5.228.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NgZc64BqMz8QrkZ; Mon, 26 Dec 2022 19:01:58 +0800 (CST) Received: from szxlzmapp05.zte.com.cn ([10.5.230.85]) by mse-fl2.zte.com.cn with SMTP id 2BQB1qBG066734; Mon, 26 Dec 2022 19:01:52 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp01[null]) by mapi (Zmail) with MAPI id mid14; Mon, 26 Dec 2022 19:01:55 +0800 (CST) Date: Mon, 26 Dec 2022 19:01:55 +0800 (CST) X-Zmail-TransId: 2b0363a97f23ffffffffc970d89d X-Mailer: Zmail v1.0 Message-ID: <202212261901554408949@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , Subject: =?UTF-8?B?W1BBVENIIGxpbnV4LW5leHRdIHNjc2k6IHNtYXJ0cHFpOiB1c2Ugc3Ryc2NweSgpIHRvIGluc3RlYWQgb2Ygc3RybmNweSgp?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl2.zte.com.cn 2BQB1qBG066734 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63A97F26.000 by FangMail milter! X-FangMail-Envelope: 1672052518/4NgZc64BqMz8QrkZ/63A97F26.000/10.5.228.133/[10.5.228.133]/mse-fl2.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A97F26.000/4NgZc64BqMz8QrkZ X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: 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/scsi/smartpqi/smartpqi_init.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/smartpqi/smartpqi_init.c b/drivers/scsi/smartpqi/smartpqi_init.c index d0446d4d4465..1f8f3aee37b6 100644 --- a/drivers/scsi/smartpqi/smartpqi_init.c +++ b/drivers/scsi/smartpqi/smartpqi_init.c @@ -996,9 +996,8 @@ static int pqi_write_driver_version_to_host_wellness( buffer->driver_version_tag[1] = 'V'; put_unaligned_le16(sizeof(buffer->driver_version), &buffer->driver_version_length); - strncpy(buffer->driver_version, "Linux " DRIVER_VERSION, - sizeof(buffer->driver_version) - 1); - buffer->driver_version[sizeof(buffer->driver_version) - 1] = '\0'; + strscpy(buffer->driver_version, "Linux " DRIVER_VERSION, + sizeof(buffer->driver_version)); buffer->dont_write_tag[0] = 'D'; buffer->dont_write_tag[1] = 'W'; buffer->end_tag[0] = 'Z'; -- 2.15.2