Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp56070rwd; Tue, 30 May 2023 16:08:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ605RVizAsZvs/3IrcvEdNwFdDj8NWin+IasMKpon7PUyIE8XHpNbjnaG7qPt1qi/vhsOn/ X-Received: by 2002:a17:902:eccb:b0:1a9:6183:f965 with SMTP id a11-20020a170902eccb00b001a96183f965mr4493432plh.60.1685488135083; Tue, 30 May 2023 16:08:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685488135; cv=none; d=google.com; s=arc-20160816; b=T5BjrzXJiEEjYZa1RLdYPq68E145bnXagLpEvDFeU/u6F//6ev4ypfK/+v2I8WwAnO hjTHaa44NdkLm/0T3N8J4EeXZT25IVuG4dSypqFs1vQiLjYj1mT/rQQ/fF7wuZdy2XgM Db0UAFzww8sGi5HFfzq5g6cwtoyi5Wcmr/84sJfB8vUpBoGiQu5DBT2YFfZ2mHT7iBqX IUXsUUhJji97kCZ3eVIQHGjxlcWb4XWP3gQp3EMxaEcp1gYqRGRyPf/25RGaMVZccpkn 7RV0Vz1KjP0yUO5pZ54kHlFfdM6/7QvDeFBujwC79aHBosR+lgHcU6y5hGtWoUMUv2NW pWAw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lIZITtN2bKn4epnZA2aYk+MPyTdtLfd4FD17Mvvuc+s=; b=BcYygfzHZpbp50M9HdkFvua3p15p+9LoHOjkifHRqt4n38v9jtV0mC6PTyLATUDt4+ 5CD27MAEPWMkNXDL8Tkgdd22nJI+bIeDy/mjgX4CP7wpAQdfiCoEVHkeJwndaO5wuAvw hhimtqh3DElz9qQmuD8ciZohTaBaTrgIK1w2MEZzruEq2ZicfyGGUZjFVmv7T73cZdJC EbJvHuhOrq0WZgkwr3pS221OTHzB58VodbnQUPjm7hcnUbpkyqXG3Z8+S3dJ5oh447Fm BHlLcDQJaKsitZOHKDn/SrewGmcX+izTRongN+KnE/e2RpK+KyCKlwom1UhBlk9FpuEj NJyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=c0hOeQpS; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j4-20020a170902da8400b001b05e96d85csi2071739plx.341.2023.05.30.16.08.41; Tue, 30 May 2023 16:08:55 -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=@chromium.org header.s=google header.b=c0hOeQpS; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233654AbjE3XGb (ORCPT + 99 others); Tue, 30 May 2023 19:06:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37714 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233615AbjE3XGR (ORCPT ); Tue, 30 May 2023 19:06:17 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D4EEE8 for ; Tue, 30 May 2023 16:06:16 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id 98e67ed59e1d1-2565b864f9aso2230722a91.1 for ; Tue, 30 May 2023 16:06:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1685487976; x=1688079976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=lIZITtN2bKn4epnZA2aYk+MPyTdtLfd4FD17Mvvuc+s=; b=c0hOeQpScZnxVdLys+GcGo36POTD+McxKYLKI2O2AJP93Y+cMku8bLaYjilcymC99G ajnfrL573vrFpsgBn7xnJi1Eb3TQetX1BSBfOMfUoZh6xoPjFrnTrPTojvFJxekXH0/k AkrK5vEFS4WJq6XtyNCJ0ZQBHeoQmBD8CIPWg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685487976; x=1688079976; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=lIZITtN2bKn4epnZA2aYk+MPyTdtLfd4FD17Mvvuc+s=; b=JszlOK16oNA6F2gLn0TLSQGTaUuSjuACCnbWexLlSK3nJLhamcFsX1e/U4d8VD5wPJ 8xLSyhOx0R/wjrG3CLlZtUq+2OhrRGHGx3bMp2/mdB7m8QGcldaKYdZR0EZjjwt2PGp3 VwJ+nx5LLqGKQTpCbOVAxD0n7w+0impQMuM/NLWIxiWu7K43/fxBgNbBoxVjj8nyLdiA fgn1E0kSacDry7anjE9VB1kstwHq+B1pYHWMclBVhxFnPB/X311FiLoLocuXul0CpZ1H Cuxx3TFbGMl0CGJ/mGYgepfIfFt7CruqOXYz6EnLGlJuEcU1Zs3qxd/B7sotCXkYU8On w1gg== X-Gm-Message-State: AC+VfDwYKSnaQ8ZFNnfS0I56ZRAHyRnTtNGq7zXOApfC6y6Otv9h3G42 PW271oBRQ+Vut9Dz2kdRM06Vmw== X-Received: by 2002:a17:90b:3908:b0:255:c461:6405 with SMTP id ob8-20020a17090b390800b00255c4616405mr3924044pjb.15.1685487976005; Tue, 30 May 2023 16:06:16 -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 e8-20020a17090a77c800b0025695b06decsm3351803pjs.31.2023.05.30.16.06.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 May 2023 16:06:13 -0700 (PDT) From: Kees Cook To: linux@armlinux.org.uk, azeemshaikh38@gmail.com Cc: Kees Cook , linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org, daniel@ffwll.ch, dri-devel@lists.freedesktop.org, airlied@gmail.com Subject: Re: [PATCH] drm/i2c: tda998x: Replace all non-returning strlcpy with strscpy Date: Tue, 30 May 2023 16:06:02 -0700 Message-Id: <168548796309.1350188.15805729218836239223.b4-ty@chromium.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230522155350.2337029-1-azeemshaikh38@gmail.com> References: <20230522155350.2337029-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 On Mon, 22 May 2023 15:53:50 +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(). > No return values were used, so direct replacement is safe. > > [...] Applied to for-next/hardening, thanks! [1/1] drm/i2c: tda998x: Replace all non-returning strlcpy with strscpy https://git.kernel.org/kees/c/a7aba6fa2750 -- Kees Cook