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 E381CC7EE29 for ; Mon, 22 May 2023 20:16:44 +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=1kxabpSF6or9zaj3m/tlTjZ/Ez2K3ndgrG08XixuD6Y=; b=TyfGMVLCdIy6OK zlMXW3k1kbHxocFUtua2imKw+h5hJOt4yb8xjpIaGIipvyn0vKAPIprlnweB61mQDtavCawUS1Zfj 7gOMVh5ec/YaMlewcxQlfj17B/BfhNxvx18aXl9ucN6M9Dv63aD99UeCeiGsPVAaFZqt35K8s5emS KVVpsWCveEDmXx2g+YYvgZVCE8T36YWhs32SNhkAW3HEd2yIx6ug1wWMTfOZS+yi25q7JyzZu8VEB i9qjj0j7Y8d5s0axngs3lqz3oLqjH73Up4zVHLWrzLzt/BxoJdoiXDnH6AVF8lU9azM2nT4GLrEVJ 8/3gDRHN7JbqgelZS04w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1Bx8-007sV3-35; Mon, 22 May 2023 20:16:22 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1Bx4-007sSn-2z for linux-arm-kernel@lists.infradead.org; Mon, 22 May 2023 20:16:20 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5144a9c11c7so5851916a12.2 for ; Mon, 22 May 2023 13:16:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684786577; x=1687378577; 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=IXAgSSaBSjm1CetJruAB7G9vGtE1c+hHoYZB1utEDWk=; b=QQTUxhTD+GBKEguQUQDkEE7nMOAe18rTZR4yd2iaOBBDSLRz7YTvTiKzOUoz/KfNRX 53a/09Vvla3KWcqtTiP3yI89difUnrz+iE00qjLf6kPKp7r7w0Bkpvbvvp7WqhswLcI5 P7LmB9YrcotM+OM13H5iyJWT/jIaabCUXsyr4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684786577; x=1687378577; 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=IXAgSSaBSjm1CetJruAB7G9vGtE1c+hHoYZB1utEDWk=; b=d/wa/bXIL/W3hIZRTl2xBeYAYAyuYTX0Z8NwPhdsN7baQtW5rUo7O4xIk0rWVoyV3k oakqmtrJfxx5ehizqhQRNoYGeTUOhlAZUy6Rl1T+BTUSWDRBYCgCt/6AhMNk7UvDtD6y to0f78+SIpo1mOsIQ7DFBfETF5YyX3frl+y6cgZIY1AZbvBAfAeGQ7g3A165Azq/S0c7 JXoLegdLqJLBNyXSsG2CeThy/tsCvviGYtsIMHJXRD+Cxksv+Zaz8iOevxonlVM1Uf9l lNGMj6jwjeN61VCp8fgcqgDWAEXc/a1VZ5GaO5O7UOpwuCyArCvMFvo+V/HbqGpV2BUJ uWLA== X-Gm-Message-State: AC+VfDyEx+0N4O6BNqxdfCVmnf69Vc60ZIYYSSvg8jsdkk9GWb7Bfsos mT9VbE6k1ETSaTcWjYX4b2jpZg== X-Google-Smtp-Source: ACHHUZ51FT7XO9iVtfE7W8pRe2pp+oF+jrhOC7+wSnz9QKew8znPQk021RvlTVHrkhez485O6aBqLg== X-Received: by 2002:a17:90a:a611:b0:253:2dc5:4e12 with SMTP id c17-20020a17090aa61100b002532dc54e12mr10854532pjq.46.1684786577531; Mon, 22 May 2023 13:16:17 -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 fa12-20020a17090af0cc00b0024de3dff70esm4445821pjb.56.2023.05.22.13.16.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 May 2023 13:16:17 -0700 (PDT) Date: Mon, 22 May 2023 13:16:16 -0700 From: Kees Cook To: Azeem Shaikh Cc: Maxime Ripard , Chen-Yu Tsai , linux-hardening@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, David Airlie , Daniel Vetter , Jernej Skrabec , Samuel Holland , linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev Subject: Re: [PATCH] drm/sun4i: hdmi: Replace all non-returning strlcpy with strscpy Message-ID: <202305221316.FE9BC18975@keescook> References: <20230522155331.2336966-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230522155331.2336966-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230522_131618_968529_C07F6EBD X-CRM114-Status: GOOD ( 12.41 ) 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:31PM +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