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 8F6AEC7EE29 for ; Mon, 22 May 2023 20:15:55 +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=3pwrem4BugPTyH575MFHLxuDV6K0ECghnz2+NTXOQCA=; b=u7mOL65/nns0TU 6gRWjgxEusDkgVU76UKxCpTSQbwEgMmksxol3ccn3sxo+/LtGVNQc6HhfgVZSN03GhELNJuAnPWAV Kdy/ThAj7o3Y+lzQGUwT1EcqEesTbtCAd/KulfzJ+wEhXrIxtCwiPaniMCT9ElQfw0049rRc/WOxk L2v9hMLxrswUYhrg9ic2PfXsjsGIUG7Hjai27GgbCiR1LpKDpbpQT3b6ZdLSJHkEArLrH60Lh1zJ2 f/Bp6tScSmnIS7GA/wbPWdNYHdKhEGPu7r317mgj4U9iIuHf4CQSVtCV1SM2xtmeQhXx1Sy4eEkJ7 0HHGrhHXw9OETCMfs7Uw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1BwL-007sC3-0C; Mon, 22 May 2023 20:15:33 +0000 Received: from mail-pl1-x634.google.com ([2607:f8b0:4864:20::634]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1BwF-007s8j-0X for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 20:15:31 +0000 Received: by mail-pl1-x634.google.com with SMTP id d9443c01a7336-1ae557aaf1dso56155595ad.2 for ; Mon, 22 May 2023 13:15:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684786526; x=1687378526; 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=Pdrje6wvnlDZ+Z6wbd9zxIlTwzeS32i409hLZznOFcY=; b=IKgGDbfMAFcTW0fCraBOWKLWmKW3iVgSXiA5H6aqBySMQvF33LN3e/4WaaVBfsNkiv rlwvatxvFaLKPYJiJOQxmwX7qux9hU+DbTGFv0sTcdeK2WbWfEGPKqRy9tINpmr6Gs9P +LMTABtMt4FGiI3+DOzwVFbwur7RscLj5yUcg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684786526; x=1687378526; 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=Pdrje6wvnlDZ+Z6wbd9zxIlTwzeS32i409hLZznOFcY=; b=Am3pjh0anwEbK1OvCrcstOJJqn4iV4dudMV84IKtKT78sAq8OoYObPBAuISmLU6GkK XiXFRPoDHq/tm8wHHLktpT/dCcGkoqQFMTgUZTlCi/6AiD8VfN7Zoh9YvUDCgEXtLKmE 1/WRQ2/Cm8pzoUkGhm0hYqhL50h+5S1Ya7bOGB4j7Hku2+nwA1hT4PoSbKrkmmDkb4Z7 yypuE1gPCmlWccykUUu5LhWr3joSwb10gydFKNkpxw/rW/ODtccG0ww6p0RSP2etmha0 xH9k3s+/zMJdrfdoAn4zfukNP7QpVTenF2Q9z/gCFglqiBXHyC8q2gFLDglMqoUtynS8 Zjig== X-Gm-Message-State: AC+VfDwLBPtumL0+t9gqRgqXHIbRgSNeuUpMo3uxObcZhIeKVz10GbCD aARV4XhbNrFi4uU+7ZEDKvTm9A== X-Google-Smtp-Source: ACHHUZ7wj/gcQ29SqjtFdOT9i9jtD3FakkeSS/upmgojrQC0P7/HF13gNCI198y84KiPEaHhCoJBeg== X-Received: by 2002:a17:902:b288:b0:1ae:56ff:74e with SMTP id u8-20020a170902b28800b001ae56ff074emr12788781plr.9.1684786525810; Mon, 22 May 2023 13:15:25 -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 x1-20020a170902a38100b001a6ff7bd4d9sm5339234pla.15.2023.05.22.13.15.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 13:15:25 -0700 (PDT) Date: Mon, 22 May 2023 13:15:24 -0700 From: Kees Cook To: Azeem Shaikh Cc: Sandy Huang , Heiko =?iso-8859-1?Q?St=FCbner?= , linux-hardening@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: Re: [PATCH] drm/rockchip: Replace all non-returning strlcpy with strscpy Message-ID: <202305221315.B1E5C7B@keescook> References: <20230522155149.2336620-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230522155149.2336620-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_131527_204991_F48445DE X-CRM114-Status: GOOD ( 12.30 ) 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:51:49PM +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