From patchwork Sat Aug 5 07:51:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Straube X-Patchwork-Id: 131457 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp342483vqr; Sat, 5 Aug 2023 01:44:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH57mdFNHtijSrhtsQLFTdiLcQ3WKQ/9r88PSgUo8Q9ZeQ0UoS1GRpO6b3E4uwAH1ofb2FR X-Received: by 2002:a17:907:daa:b0:98e:738c:6d39 with SMTP id go42-20020a1709070daa00b0098e738c6d39mr1867569ejc.36.1691225070965; Sat, 05 Aug 2023 01:44:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691225070; cv=none; d=google.com; s=arc-20160816; b=h1icWNR2lNJUaZV2+yvXIoix4oVJww+ofeyBBAQVG2tVEqHQFIW7h6ny9QmrY26Dcd 3LatblviM3A8HS3n/LpkhKQqUTfZoRuY2zBvbnby460fM4NP6uDfSCkHbgeiHyPJ2w4f 09ekRl+9A2k3J6GYBO/VFQJ1ZlVt2lnOY+nnUTJ8YhtmtYNPvMgqrPkic11dDwxPvU2j SJlzNcbpu38mhB64b5upYMKHoURRIQBDD/gNXPZWGYvR64Nd5B+5zDo3A65hboxiIHKj bSBRQt6sYOkC1GBFlqBmal/dQSjzXfIvSe6530AM11HNjGUisQ+FPRlpDrE4ftzLWkUA AVtg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=Qo01VZv46WbWZeQUoDu+eNXSK4QNZCobvRPShRBmW3A=; fh=67QlFMbcpQu2o/7zp6Br1M0nsTpFNHLJBxxKy6nRf8w=; b=fPWMjDbmvEEoYm7pW7NrCIcTVyX4WtRgQA9Kvqa2LOuyVq5N/8cwduyN1ZdUSk7kZU qx4/0AwWNQG+FwWCZWhgAgPj5qHfoQexx9iD1Yj+1Y8UXowMwbb1Z1p+JxsuC3V6ZuXo MVMc1+ekSHEdVPD4T4vZ28pWns9xN2NVhuCuKLf4E4EFWIDe+FxHLQHwqhTyoyaM4tuH Zvr4ypr5GaRY1pWZULuhRZmiyIFoFMArC5VJv5DWK1l3wUnxIFHFLWV+w5JKXFHBw5CY Q4RArCKSI2/YyblUsPHgypHpIE5qpnJ+xVngNMAloSmxDTt/iis4ZWxbVPRp/TX6WQYf dWlg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="eFa/+pdZ"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z17-20020a170906435100b00992f45c9343si2699596ejm.1025.2023.08.05.01.44.07; Sat, 05 Aug 2023 01:44:30 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b="eFa/+pdZ"; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229619AbjHEHv3 (ORCPT + 99 others); Sat, 5 Aug 2023 03:51:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229460AbjHEHv0 (ORCPT ); Sat, 5 Aug 2023 03:51:26 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 138754ED0 for ; Sat, 5 Aug 2023 00:51:25 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id 4fb4d7f45d1cf-51e28cac164so8281557a12.1 for ; Sat, 05 Aug 2023 00:51:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691221883; x=1691826683; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Qo01VZv46WbWZeQUoDu+eNXSK4QNZCobvRPShRBmW3A=; b=eFa/+pdZy12eq7uhOk6oj8lqvgCn7Ccc2eymJdN9wZhYSADZd8x6/6x2r1uWtvr275 nyWcYMIKSTfIBpD31rf1i1b8J5jyywnbJeRYabxqSCY3j4Y3ndQZmv3frI4wf5/7f54x oPSjlE3KIgZ59NjdIlXI/XvfMMOrxlM8gGh+LfYqQHR3qkSBHrL9XQR8wwHYQyYUlYoA dPuQP3yA8Fqb8Dd5vbDrbOzpO1uTVyd3cDeOMNRQTeAlpzW52ysHL/SNGq6b65iJj2MT wGTflgu6ROT5KHYPu0mIZKZn1s1o51tdEzuv71ijYEjyJ46xFD+a3oHdg3Akhf7bYqMj C3yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691221883; x=1691826683; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Qo01VZv46WbWZeQUoDu+eNXSK4QNZCobvRPShRBmW3A=; b=WjyJKUL9Ur7UqXCJNwvFGF0CdCriITJX+CMIUeRCKYj5edQ+SDDhBNDvHJ/xvB4Hg1 YFPNFHQddlDJ9HUSGd9ym0nqZlkO2O27oA/SK7Tjok7nuUd/CdBNYsWjg04tsIUueOiq d6oDJr1jAXB9FGaqj4IjlQ5j4ebUID8IOU43LQVIEEAPOHXAn+DbEvXelTvM9CKZzfp6 B1dtUwy7fMMuGk2yOCvEo0F4F1j7VKaBVeN31uqdfY8YIZ142YXHGuvClPu3ldSLyOJW ZGlOGTyX8nLKRqvEtD7e0FF6Yfpx8OmFeK+6rY8JvV1fPY7/t5c1ryhJXztZk53FzILQ bZUQ== X-Gm-Message-State: AOJu0YxMezmPfl+1se94GdfXeNJbLfz5GYX4gedAO2swRFAI/aeaZpGs wJMBPrWs2DLocUVPwS2jkx0= X-Received: by 2002:a17:907:7f91:b0:99c:572:c0e4 with SMTP id qk17-20020a1709077f9100b0099c0572c0e4mr2255590ejc.7.1691221883217; Sat, 05 Aug 2023 00:51:23 -0700 (PDT) Received: from localhost.localdomain ([95.90.187.185]) by smtp.gmail.com with ESMTPSA id o17-20020a17090611d100b0099bd0b5a2bcsm2379716eja.101.2023.08.05.00.51.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 05 Aug 2023 00:51:23 -0700 (PDT) From: Michael Straube To: gregkh@linuxfoundation.org Cc: philipp.g.hortmann@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Michael Straube Subject: [PATCH] staging: rtl8192e: prefer strscpy over strncpy Date: Sat, 5 Aug 2023 09:51:14 +0200 Message-ID: <20230805075114.15186-1-straube.linux@gmail.com> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS 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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773378020109068290 X-GMAIL-MSGID: 1773378020109068290 Replace strncpy with strscpy in two places where the destination buffer should be NUL-terminated. Found by checkpatch. WARNING: Prefer strscpy, strscpy_pad, or __nonstring over strncpy - see: https://github.com/KSPP/linux/issues/90 Signed-off-by: Michael Straube --- drivers/staging/rtl8192e/rtllib_softmac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_softmac.c b/drivers/staging/rtl8192e/rtllib_softmac.c index 0e52b207942d..bd19d6a2ce41 100644 --- a/drivers/staging/rtl8192e/rtllib_softmac.c +++ b/drivers/staging/rtl8192e/rtllib_softmac.c @@ -1564,7 +1564,7 @@ inline void rtllib_softmac_new_net(struct rtllib_device *ieee, (!strncmp(ieee->current_network.ssid, net->hidden_ssid, net->hidden_ssid_len)); if (net->hidden_ssid_len > 0) { - strncpy(net->ssid, net->hidden_ssid, + strscpy(net->ssid, net->hidden_ssid, net->hidden_ssid_len); net->ssid_len = net->hidden_ssid_len; ssidbroad = 1; @@ -2431,7 +2431,7 @@ static void rtllib_start_master_bss(struct rtllib_device *ieee) ieee->assoc_id = 1; if (ieee->current_network.ssid_len == 0) { - strncpy(ieee->current_network.ssid, + strscpy(ieee->current_network.ssid, RTLLIB_DEFAULT_TX_ESSID, IW_ESSID_MAX_SIZE);