Received: by 2002:a05:7412:f589:b0:e2:908c:2ebd with SMTP id eh9csp77484rdb; Tue, 31 Oct 2023 00:46:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYmqvkNa4r1Kh5WmxM4u1FjALEhT4zEy8Bvj6BpIZBexzmZMldzW8Wiyjv9xOPLoOXriIq X-Received: by 2002:a17:902:ecd2:b0:1cc:6dfa:ca55 with SMTP id a18-20020a170902ecd200b001cc6dfaca55mr186356plh.25.1698738412905; Tue, 31 Oct 2023 00:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698738412; cv=none; d=google.com; s=arc-20160816; b=XHivgZ2Dm7mLMZ+g9ITrXbEG0RI24CLXxsISw+52mLLUJnEes+dUfzT8K61EkYxQDu fhc5r2ATDi37gUR2iSih3A4HeLvdDAZ8MTCPqBfqDiOpUCmJN9Wi+uOBO1fzggNdiEKi LJ2G1jF+m20QcLoIM7j+B+FVm8pPhdLBEl15nige7QpzKlLfiVD0Ug8R34tj/4z9PQLg dc0VidtE3wNb0sD5gp1fC1srxDdlz1WOvHHd4/E23pddifTXBRM8ae8AP+c3OiRteO3v BCPB7y33z55+S2rRoFZdZEk/xcvUVnV71hNtxKYXLZgjjTXDc0jVTJGthJWflrZumI9v AmQA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:message-id:user-agent:cc:to:references :in-reply-to:from:subject:content-transfer-encoding:mime-version :dkim-signature; bh=7e1hxciCrsMuUJkrjS372hckolZyZb+AYw5mKRT6MEo=; fh=PksSGNpDqLuginK9iEJUj5tnX7gB0Qd+4SxLYpmT6q8=; b=C4CypIoiMG/WIkjER9doiTCP8Z7M8CMJYnGFVLZpbXx2nYZ6H2VCPRTeOMV3j1xLq1 Ed1P4bW/IAVULnz5Uh0jGk20AkuUFZ+QVo1ym9Ei212XxMdh/WdL1EGZdXEfNPvBLUpJ LMoPx+wGpg8xTPDUQuKmkLj7eO/yXqC7nL1is5EDShT0X/ebbSNoqPdvhEkEP03vZSaC OYEMCv9YsdkeF4891Mbsa1QouhL1u7h2C0hbzIbgM1xstho18MQcefO2DgXwI+swBHCu SeM8JvpOgqCVpJdWki4duhwTINUwA5d5RJ4uMgHTIJ/ctdlSGZ/jvGnoxP25hDR7iUtX F9Gg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WGcrOe5O; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id h7-20020a170902f7c700b001c1e1fe16c7si641920plw.236.2023.10.31.00.46.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 31 Oct 2023 00:46:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WGcrOe5O; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 88283809C12B; Tue, 31 Oct 2023 00:46:50 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343751AbjJaHqg (ORCPT + 52 others); Tue, 31 Oct 2023 03:46:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343733AbjJaHqe (ORCPT ); Tue, 31 Oct 2023 03:46:34 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A61E4; Tue, 31 Oct 2023 00:46:32 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 78F32C433C7; Tue, 31 Oct 2023 07:46:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698738392; bh=g2XziSccx+MTDgQb4k51PyXlsNg5Uj2V1xR5ZbJYWag=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=WGcrOe5ObTvGcRZ6pX6hkz+aPhA7kHHm0mt4/hIdYnyiW2UVQ/9FZqh3qiSEr1J7F zGxm8fgALAca4sN4K4RV3P367XQeqTSHIYgGYCwB91RArrx76cGmP5dAC1S2rCldW9 9OtRU/CNsRDOqPUcqb7jwOheo7yDrvhAWQ0wkbpH6l6j7pmQEB4DNaDWa4VbH9xf8w OhbK4idB2x5uuiZSnjtu8b0BDBBjlHnO7B8p9isuy5AfUFmFiqmnnX6HOZg3Nc7dmK AluiO7zIYnKFcBxAVYHwJk2xMDIOy9Zv1P7UvzeZzWLa76iOoeeLWt14dPsNWBiSAZ WZ0IwQibD8GkA== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2] wifi: ath10k: replace deprecated strncpy with memcpy From: Kalle Valo In-Reply-To: <20231024-strncpy-drivers-net-wireless-ath-ath10k-mac-c-v2-1-4c1f4cd4b4df@google.com> References: <20231024-strncpy-drivers-net-wireless-ath-ath10k-mac-c-v2-1-4c1f4cd4b4df@google.com> To: Justin Stitt Cc: Jeff Johnson , ath10k@lists.infradead.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, Justin Stitt User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <169873838825.2137176.1962660661621825377.kvalo@kernel.org> Date: Tue, 31 Oct 2023 07:46:30 +0000 (UTC) X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Tue, 31 Oct 2023 00:46:50 -0700 (PDT) Justin Stitt wrote: > strncpy() is deprecated [1] and we should prefer less ambiguous > interfaces. > > In this case, arvif->u.ap.ssid has its length maintained by > arvif->u.ap.ssid_len which indicates it may not need to be > NUL-terminated. Make this explicit with __nonstring and use a plain old > memcpy. > > This is also consistent with future copies into arvif->u.ap.ssid: > > if (changed & BSS_CHANGED_SSID && > vif->type == NL80211_IFTYPE_AP) { > arvif->u.ap.ssid_len = vif->cfg.ssid_len; > if (vif->cfg.ssid_len) > memcpy(arvif->u.ap.ssid, vif->cfg.ssid, > vif->cfg.ssid_len); > arvif->u.ap.hidden_ssid = info->hidden_ssid; > } > > Link: https://www.kernel.org/doc/html/latest/process/deprecated.html#strncpy-on-nul-terminated-strings [1] > Link: https://github.com/KSPP/linux/issues/90 > Cc: linux-hardening@vger.kernel.org > Signed-off-by: Justin Stitt > Acked-by: Jeff Johnson > Signed-off-by: Kalle Valo Patch applied to ath-next branch of ath.git, thanks. ac2f43d3d34e wifi: ath10k: replace deprecated strncpy with memcpy -- https://patchwork.kernel.org/project/linux-wireless/patch/20231024-strncpy-drivers-net-wireless-ath-ath10k-mac-c-v2-1-4c1f4cd4b4df@google.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches