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 8D58EC77B75 for ; Mon, 22 May 2023 20:16:39 +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=a756rEG1wq5yORPnjugP6oknxMw2Ft5nlsYfc9BklDk=; b=48s+HmQeUmORHp HU95MLgyT6mRxLaxxsBO3cnWKvx5bIpFrBVjBPwa9Xn6OI55pwc6LhJyNIve9+J4BDqNhC3hvLm9/ ytDTie9ykWo1QNTgJ6kf7nnX8zHtQEoSwDJ8shNaXjAasiOeLTIQIa4btgUxnzMJle9hHWhbN8sSh t6E8xButuAP+RhehfyhNYy2QfLy0loRb9FLmwEJE1bLDPFACVlKlhlQsXy1KRSbLT16oeGgPUkkim pQjwSBqbg8LW/6VPmVKGGrrZWNo4U9EEJC+abDc+9LBK5WGXuNoIdhA5ZNj+zQGv3JXRZRbkcaC5A lA8bfOqueo0wSPS611GQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1Bx2-007sRu-0e; Mon, 22 May 2023 20:16:16 +0000 Received: from mail-pf1-x42b.google.com ([2607:f8b0:4864:20::42b]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1Bwz-007sQ7-2S for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 20:16:15 +0000 Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-64d2b42a8f9so3496751b3a.3 for ; Mon, 22 May 2023 13:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684786573; x=1687378573; 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=bBzsEFEBaOoamjuMu6tkFnCdq33AsZWodYlngR5umYI=; b=NQpIylAo879lZg+bIGPMAEf7DDZr1HUjRDRjXgFFzOZAqJismdNG2vT6fvEGnxixbE AO59fHineVN3ZV8SGUip2kK2YNl7yCMhINlOucn3D9rFDYquHDJDjZqxyorrI6Aa1PG3 dgDmEFNb5d5Gy4SPsHORvJXWSanJ+OBQLiiBo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684786573; x=1687378573; 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=bBzsEFEBaOoamjuMu6tkFnCdq33AsZWodYlngR5umYI=; b=GDqG3cbRVuT3C4kAdrLM04txDmaH3V2xFJgQNj2SwMYY1bi2bCVb7F+QeIAs9C+0oO zTcITquCvfuc5jP5+2GRklFCUf5+V7NcFemiDPO2ZeBdkYKvOoSQ+8I9imahx77RCG1l 4Mt7A0ZJ1/JIiB2g2jvIAQyLZ86I5UCk6z0AU9BiT612X/65Ent6zc7iTlLcmQkQnnSa LTQ13GKc4XxwkYFpSjxxQq8NEgbySeDoj/ekPH3/OlkykTH3oEKAAxbk0n4ZEstyvy+9 2Ts+qDOp7afGIElCMQJ8gIB46t8+ETho+mqkQsGHYc3vANwS11qbLRCNbJ4KZ21fEcLE 2sWg== X-Gm-Message-State: AC+VfDwCIvDBloeBCgozZRItPhmd+1ZSrVD8gwglSB4rW0e8ZOSwLBrX X8VRIHnCz2SaFFLX83wJpNHCcg== X-Google-Smtp-Source: ACHHUZ5ATfKSsDeoySmt4TpoCC/s6QT9JMih/7kH5QlewrwQzwJyKfURuuEBVyEFMexNU1NyLHmTzg== X-Received: by 2002:a05:6a00:a20:b0:64a:4bfa:6b8d with SMTP id p32-20020a056a000a2000b0064a4bfa6b8dmr16642693pfh.6.1684786572799; Mon, 22 May 2023 13:16:12 -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 d26-20020aa7869a000000b00640ddad2e0dsm4512884pfo.47.2023.05.22.13.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 13:16:12 -0700 (PDT) Date: Mon, 22 May 2023 13:16:11 -0700 From: Kees Cook To: Azeem Shaikh Cc: Chun-Kuang Hu , Philipp Zabel , linux-hardening@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Matthias Brugger , AngeloGioacchino Del Regno , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] drm/mediatek: Replace all non-returning strlcpy with strscpy Message-ID: <202305221316.5C8770098@keescook> References: <20230522155306.2336889-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230522155306.2336889-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_131613_800878_A31B8FDA X-CRM114-Status: GOOD ( 12.39 ) 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, May 22, 2023 at 03:53:06PM +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. > > [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 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