Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1292416rwd; Tue, 13 Jun 2023 07:21:22 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6bY6EpVsdxML/6rVD9gOKtOvJK4T0bLxMnNdh8XziVzrkZWD7fvijhI04/24bOl1erB9hU X-Received: by 2002:a19:4303:0:b0:4f2:62aa:986a with SMTP id q3-20020a194303000000b004f262aa986amr5834245lfa.21.1686666081792; Tue, 13 Jun 2023 07:21:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686666081; cv=none; d=google.com; s=arc-20160816; b=HNsXUtkSd5i4ajm2+QtLT22xNByz24FOcn8+g+SfyydRKuu+cMVA+S/5Ir0M6EMe0R UmzPSlQqP5+huqRMGJpGoCI4TTAHWfV5RinpsgKyM9MWZD2gSdWN144Eg3cvNTIVKRX3 fr2v4Qniur15fJqO6+QVwFARVp83NHI9it1Cg4VEmvXxiO2Ba+Abp42K5Vls96loxsUA 7bdFG5wSHivzbmrFM7t7WxSo0oIy9A2ruJJx2XbnmlKcxBVbK6EA4tp/9XPTrnjxNJIM BcApOKP4cSY0vc6xHAhd5nNztK1lVz89N8CnpZNX1YDJ4QytrarZ9kiGBsK4EI8RQguK pCxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2YTrJ+Te3mEYu4FIASWLgAG2xDCPqUruxk2W5WEUHHA=; b=kegZlCag3LuvX7t8K1Z26Ezh3dtp+Bkuc4RQlw867ZHAaEeY+BSu/mzom2kXaq/p6t wq7mxfCE/xsAtvns0l3di7SbvM4HexdAQQVctE3gA2d1IsVS/pRpR1frW0BOvo1lU/iN +2V4tyXTR9bxzIbI1VvmBbuFOzbA0wLiMSasJqLolTXnapOtR8sciNMPSC72DZ8yrCwZ l+i2CXV6k2msf8QqAXx4fex4sAt4p6k1broKmHn+an4aRPocd+ZX++5dU3A9TBKe21N6 0pPnigcjnHvub4Q9UVi78AXijF+4FtnC2RmX/kh9/o+2Q1thbihl6sQYKiG9CjDBNUne lY6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=i6oIRqky; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w26-20020a056402129a00b00516a1751d76si7440965edv.562.2023.06.13.07.21.04; Tue, 13 Jun 2023 07:21:21 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=i6oIRqky; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240402AbjFMOMJ (ORCPT + 61 others); Tue, 13 Jun 2023 10:12:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37006 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240919AbjFMOMF (ORCPT ); Tue, 13 Jun 2023 10:12:05 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63C4010FE; Tue, 13 Jun 2023 07:11:39 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id ffacd0b85a97d-30af56f5f52so3798847f8f.1; Tue, 13 Jun 2023 07:11:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1686665498; x=1689257498; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2YTrJ+Te3mEYu4FIASWLgAG2xDCPqUruxk2W5WEUHHA=; b=i6oIRqkykFQzwuOvBxb6qZIcBlZ2d6Q/5DRiOjk6giQ4jHLWS7gsZx8Qp6D8cc0E47 JWYecVEA5KRO8qW8+ugcnxHY40r9mJsSxm5CYUfKfV0Q1pfYY8I+OJ8ckUWmaDlNfQDl 9IaTq/acmToOnYIRZtdCDpILoinmZ9U3q7iIgwxdBndEKQEp08t21YWu8EQ/ErAvVYBG RLZxNyulmYOgdhJh8kgK2M1ESyuLjzEkw0IQs0POZPUxTkS4jqQCeQzOsvhqPEtIy3fk QDxRIiCaFqF3oquUkQOXEgJqYxPVpw+MIaKIaJT/m+BsvGydaBHuojrAk5gO4VG6kG8X 4W+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686665498; x=1689257498; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2YTrJ+Te3mEYu4FIASWLgAG2xDCPqUruxk2W5WEUHHA=; b=BWgCiYJShmpcOVJK8DLehTXBdD1vHQB+tQ9g6Oux8B6V/vXfakMKsI1S1WgHD2V6kr 6Rmn5Bt5E89XiBdGa/wv5+j+Tnan456XDUU6EEdXXz0XeU+pXkPSnGFe7QXG1qftzMgS gAbf/1qukq3DIjwheFmtKfTZl7GbUwnRWkxZwGUOwqhxTIYjvpBYDyaJ0MQU5DDDB37u esqprhzAeE4SBDu1eCS7vUBGtuUz0UxRt/MaqN/AU1g5K5fCGVbED7EirbrihnpWNHtR EWvEMKc9PH2jUDeU5Ai5WG1/dyRc2song2t9nz8iXIJ9PW5vjbB5X79drgRo/gLF4X5x vwWA== X-Gm-Message-State: AC+VfDzts1rmyOkuZ2bezIqvIFymeD40KdOGRITeHwJVsDnqt8nlThyl 9DfmdxYdSNQizlFb0GPZKF9WS7Jh71mON3DJoq8= X-Received: by 2002:a5d:4f87:0:b0:30d:af7c:5046 with SMTP id d7-20020a5d4f87000000b0030daf7c5046mr6347092wru.60.1686665497532; Tue, 13 Jun 2023 07:11:37 -0700 (PDT) MIME-Version: 1.0 References: <20230613003458.3538812-1-azeemshaikh38@gmail.com> <168664533370.24637.14116409515016851485.kvalo@kernel.org> In-Reply-To: <168664533370.24637.14116409515016851485.kvalo@kernel.org> From: Azeem Shaikh Date: Tue, 13 Jun 2023 10:11:26 -0400 Message-ID: Subject: Re: [PATCH] net/mediatek: strlcpy withreturn To: Kalle Valo Cc: Jakub Kicinski , linux-hardening@vger.kernel.org, linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Brugger , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE 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 On Tue, Jun 13, 2023 at 4:35=E2=80=AFAM Kalle Valo wrote= : > > Azeem Shaikh wrote: > > > strlcpy() reads the entire source buffer first. > > This read may exceed the destination size limit. > > This is both inefficient and can lead to linear read > > overflows if a source string is not NUL-terminated [1]. > > In an effort to remove strlcpy() completely [2], replace > > strlcpy() here with strscpy(). > > > > Direct replacement is safe here since DEV_ASSIGN is only used by > > TRACE macros and the return values are ignored. > > > > [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strl= cpy > > [2] https://github.com/KSPP/linux/issues/89 > > > > Signed-off-by: Azeem Shaikh > > The title should be: > > wifi: mt7601u: replace strlcpy() with strscpy() > > I can fix that, no need to resend because of this. > Thanks Kalle! > -- > https://patchwork.kernel.org/project/linux-wireless/patch/20230613003458.= 3538812-1-azeemshaikh38@gmail.com/ > > https://wireless.wiki.kernel.org/en/developers/documentation/submittingpa= tches >