Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp996614rwj; Thu, 22 Dec 2022 18:56:26 -0800 (PST) X-Google-Smtp-Source: AMrXdXt5apAPj8KMJBULBxVe/q3LYZ9+FA64uhUOXyx78m3MKFVLGMfY0xVgEvi3Kpk7APonP6i5 X-Received: by 2002:a17:903:40d1:b0:18f:8f1e:e69f with SMTP id t17-20020a17090340d100b0018f8f1ee69fmr9130538pld.19.1671764186567; Thu, 22 Dec 2022 18:56:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671764186; cv=none; d=google.com; s=arc-20160816; b=phulroulEcFvZuwUpYXPAU/kmcLAmYjZVGLvDMC91zxAAPhcE/80SIhPt3wbK2gUZP tJsWWvNJRe7QlMEvFuKv2SPHhgMMW5XtUkZaIxqX+WFnGVX0Nc0v/2Yw/AorTjjLqXi6 WUsTGD3ve8wcpSA/sj1nWc/CSyuPZ+sYksAObMHkNDN05Gc7pw4HbV3GWYp5Z9eydh4D 7vaj/Ap16jpECvW/pYuDB64g0mXWo+BfRxQRd/sUT5+dPo8zTQqI+s2eSp/x1HSmWFQS zjCU4IP6zKvhWS0CjJakRmxHmakfDdDdDZeMOF7a9Mpd3aDGvefO2ouVaTDpas3phDtz fJgA== 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=rjfGAUPFVXSBlIBql1y5Im8vf9ag7sPpQjgUpr/f20U=; b=r8nmf4pMB+d5YDuCrxJH9qzhbvMQnJGAYFJ65uKauI3Y4JZx5iJZRPp03z3cxgWoJ4 RfVKSShIEg3z44iKMiWztwcMAE2thndRmN9nWlgSzT6yM41DNRDZuutXe5DjAXzK4VYS pRa3Uu4td1KBrdOdCw0Pq+1+rSSSJ4lRhueGL9KZb3u0uEm1RWlB/rf4s+/FMPyAhaQx k+hvNiV8LqiPO2QnWVz2OGBNBxmooT4mssnGTdUQg5nf5slamwaDYFJq7qUU0+Gfj5uQ Hnt4rXiIRn7B+y64NIv2Gw9CcS/rN0fi/vgLF47fvKWKIOx/k/rlzvlH4/r9gnEmD20t CrAQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 y11-20020a170902cacb00b0019110322bb3si1887406pld.248.2022.12.22.18.56.19; Thu, 22 Dec 2022 18:56:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-wireless-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 S235667AbiLWCzE (ORCPT + 66 others); Thu, 22 Dec 2022 21:55:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229675AbiLWCzC (ORCPT ); Thu, 22 Dec 2022 21:55:02 -0500 Received: from mxhk.zte.com.cn (mxhk.zte.com.cn [63.216.63.40]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 300812127D; Thu, 22 Dec 2022 18:55:01 -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 mxhk.zte.com.cn (FangMail) with ESMTPS id 4NdWxb5sYmz8QrkZ; Fri, 23 Dec 2022 10:54:59 +0800 (CST) Received: from szxlzmapp03.zte.com.cn ([10.5.231.207]) by mse-fl1.zte.com.cn with SMTP id 2BN2ssGA080385; Fri, 23 Dec 2022 10:54:54 +0800 (+08) (envelope-from yang.yang29@zte.com.cn) Received: from mapi (szxlzmapp02[null]) by mapi (Zmail) with MAPI id mid14; Fri, 23 Dec 2022 10:54:55 +0800 (CST) Date: Fri, 23 Dec 2022 10:54:55 +0800 (CST) X-Zmail-TransId: 2b0463a5187f776b084c X-Mailer: Zmail v1.0 Message-ID: <202212231054555312754@zte.com.cn> Mime-Version: 1.0 From: To: Cc: , , , , , , , , , Subject: =?UTF-8?B?W1BBVENIIG5ldC1uZXh0XSB3aWZpOiBhdG1lbDogdXNlIHN0cnNjcHkoKSB0byBpbnN0ZWFkIG9mIHN0cm5jcHkoKQ==?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2BN2ssGA080385 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.250.137.novalocal with ID 63A51883.000 by FangMail milter! X-FangMail-Envelope: 1671764099/4NdWxb5sYmz8QrkZ/63A51883.000/10.5.228.132/[10.5.228.132]/mse-fl1.zte.com.cn/ X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 63A51883.000/4NdWxb5sYmz8QrkZ 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-wireless@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/net/wireless/atmel/atmel.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/wireless/atmel/atmel.c b/drivers/net/wireless/atmel/atmel.c index 7c2d1c588156..dda4027c6a31 100644 --- a/drivers/net/wireless/atmel/atmel.c +++ b/drivers/net/wireless/atmel/atmel.c @@ -2651,8 +2651,7 @@ static int atmel_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) priv->firmware = new_firmware; priv->firmware_length = com.len; - strncpy(priv->firmware_id, com.id, 31); - priv->firmware_id[31] = '\0'; + strscpy(priv->firmware_id, com.id, 32); break; case ATMELRD: -- 2.15.2