From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D98FEB64DD for ; Wed, 12 Jul 2023 23:55:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=zAjv28AAD281SAjvdizUhZT8LsAB5Y4eWoXZhwmlMQc=; b=Vl33L6xGGlShpB YtMaLwdNOchPNS3/TbT7W5f4OuZF0amEScoXtBSDp5f5P+pF0wFVeyDsXAhUZ6RFxEXTUQNfNADos 04C0fk8gToHg8YbgrY9K8KoaKBnBttjWgCUFxOhW9tWW5dPeR7As3pcxQJ+HKX1AyCnPcuPzdOz62 lwcBdXLQ+M7g4UNo940VDmw7wBUNddnwaXivRAMV4NuBzSqENk25bbNqm6IWRuNUb989Fz8jc6Avy bidy+wFXcGEhllvxHfmvpl8oNwQrsls/Wwy5YDrE3258hSHOgSEf7pLSX2M0rxpNlb6086tFQEYpg 8w6T50iW8K80N+Rc2z6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qJjfE-001Wm3-03; Wed, 12 Jul 2023 23:54:32 +0000 Received: from mail-pl1-x62b.google.com ([2607:f8b0:4864:20::62b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qJjfA-001Wl5-1z for linux-arm-kernel@lists.infradead.org; Wed, 12 Jul 2023 23:54:29 +0000 Received: by mail-pl1-x62b.google.com with SMTP id d9443c01a7336-1b8bd586086so1292735ad.2 for ; Wed, 12 Jul 2023 16:54:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689206067; x=1691798067; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=WvkFiyqULDxpTvgtRj4icSA9iUWkpiYfk5PF0EtUrTI=; b=bmOM344cC3FsZrp85zCEuMvefaKXvyZ29nJcNSM2VxsVpaPyDIQO7SUmFD0FD1faQs avgbhXIemaecM59GyeF5bWuv1hkRIGlIkVgycsHrD+BKt4lifLjLBZl9hnhXrkL/Fvhc izik/yu9ygd36Ra8QwopPBqHdRTovzG3L8yrc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689206067; x=1691798067; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=WvkFiyqULDxpTvgtRj4icSA9iUWkpiYfk5PF0EtUrTI=; b=Ha9gK5EfjWvDGlP0W0iVMGZm/bFa6SS9jdMWmM8qZ0OX8E1MZGvM0pEWU9eR7HJ1Sv omftMIYgxnU8KRqFXvrns8BqkpM3mQJoeRmVhEBly6r6FUy56piuvjh8+EIFEB5mkRXT T76EDbL14fkV9oL6UBI+Bkvhiof6AqoWq4BWwMXiDyluSs0q3+qfDV19MzIqpOxKlaZw VeVbpUyRgKy+jD+EtRw/ELKIcaYncnrN4uKmWZjg/I4kimgtD7kh251i2lKRSfgI3s9c g6mOWif+BQWrfobnnv7Y8Nm5AaV8lNKFovma6uEqLFrE3NS84qw0200xEXLx6kNgeFZA 7okA== X-Gm-Message-State: ABy/qLayg/f6J1hVwmMymbyy5zWcTnPEJtGgQMqLhukOVBDVAPSRnZsV WTlBQgWzu81FPNPPqaVvWXkftg== X-Google-Smtp-Source: APBJJlEQsAuK2FjOXsLLwedVTL2+xDqUAFVigL9HsD7VrSvCaYnqXJH1eTzZvJK9JyPR+/lZAQjrlw== X-Received: by 2002:a17:903:246:b0:1b7:f73d:524 with SMTP id j6-20020a170903024600b001b7f73d0524mr98592plh.43.1689206066921; Wed, 12 Jul 2023 16:54:26 -0700 (PDT) Received: from www.outflux.net (198-0-35-241-static.hfc.comcastbusiness.net. [198.0.35.241]) by smtp.gmail.com with ESMTPSA id c11-20020a170902724b00b001b53d3d8f3dsm4493451pll.299.2023.07.12.16.54.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 16:54:26 -0700 (PDT) Date: Wed, 12 Jul 2023 16:54:26 -0700 From: Kees Cook To: Azeem Shaikh Cc: Felix Fietkau , Lorenzo Bianconi , Ryder Lee , linux-hardening@vger.kernel.org, Shayne Chen , Sean Wang , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, Kalle Valo , Matthias Brugger , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH] wifi: mt76: Replace strlcpy with strscpy Message-ID: <202307121653.4A9C69C655@keescook> References: <20230703181256.3712079-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230703181256.3712079-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230712_165428_679532_318A9945 X-CRM114-Status: GOOD ( 14.27 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Jul 03, 2023 at 06:12:56PM +0000, 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#strlcpy > [2] https://github.com/KSPP/linux/issues/89 > > Signed-off-by: Azeem Shaikh Looks good -- thing is using return values from the macros. Reviewed-by: Kees Cook -- Kees Cook _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel