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 ECCDEC7EE26 for ; Tue, 23 May 2023 17:21:17 +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=AGWyGr76XJzvU6uR+yAj+oaYvDvf55+yX1mlLKm96f8=; b=HpqEcpum8n3yz8 7tpyiPBootYAR8lMspWHsoL0/FTESfvO9DpPEsppW99qk3WIJj6Jo5Qd1+nlG42sdt1uvNwSPPQEt 4Qg11+5+Ekor2UY9N5Z/cMU3PndP9jsEeglRFoYufPJIWefG7FnhRaph3VjKhHNhLY2hJhzkSK8oF 2TOtT2eatCyK6aEa+V2RqVJymTnRM6heejcrV8PFWGHV0WIHdn1n55idy14zxgGjZgY0Oah61jAZa aNBowRrlDeeIRIaq/yRGS2u1p3lLJ9D/cgXs9aayabQZtTTeVFJugBRaUFhRz5cTBZzzM03rCrhUH aODSZSwEMjRZ+0B0Mm7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1Vgu-00AwHk-2Z; Tue, 23 May 2023 17:20:56 +0000 Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1Vgp-00AwF5-1j for linux-arm-kernel@lists.infradead.org; Tue, 23 May 2023 17:20:53 +0000 Received: by mail-pg1-x532.google.com with SMTP id 41be03b00d2f7-517ab9a4a13so6754112a12.1 for ; Tue, 23 May 2023 10:20:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1684862448; x=1687454448; 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=T+vO/cCzHwQuFnPVrGLDZXukRrxNDu5SHC6BXOa81Zs=; b=hTrpGv/LdaPA65qPf/L+BSDkbT6zxNZTQPjO/67q6q9Xdc3oYNnP6YT9VTuIFvwA2n zzddg+xmleQpDg8/38lvv8BZYegLr+KluMOfzUuair0+1TpySYCCpJhlWYGOgB9PEhXt X+fTUDs9r+oaJYcBZwZTy6oX1F0dGqIStzIwY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684862448; x=1687454448; 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=T+vO/cCzHwQuFnPVrGLDZXukRrxNDu5SHC6BXOa81Zs=; b=KPFyGcoOtDo5V6ACeP4qGYmZLHN8Js6y9zwD/QcTKDKkd8qwVcgrR8NQBJXMLWraUZ QEz8jEICKLlRpe6UNh+vrvWDhGEYMJH8KHXUKTLC95YhV1dflqU1FCUvH0yGEz53uYK3 E9OB4yF/cOLc0+XCEPoAr9sjcBePKfib5H+5KiZeXeLUeXQ7oA7o50afGYRsi7xemsJ0 PWwiFs0t9ZAJB/wKWjoC2PiVsOVZzUuhsXsJdKjKfdlmiA6GrCZRIqk6li6/2VLw4Tl2 UYg10TVnrc0te2JXZmHiw5mRYs8yAGo2izhWkogsMButaboyCrfi+ZV8PFrnTYgQIGvM hEIQ== X-Gm-Message-State: AC+VfDz/v89S6WEo8NJxm6/N7fNIPGFo4DlYMC0QVIqnkVhATM+8Eocp OywKMRJnHpig0yUxJaozUwxcqw== X-Google-Smtp-Source: ACHHUZ4P8xDP0TNAyj32JLK4hmrdVTDjOgl2B0qIzRYWdP+XmmGQKtfRjG2ZNIm+vY9oedRsM1SR9Q== X-Received: by 2002:a17:903:428a:b0:1ac:4a41:d38d with SMTP id ju10-20020a170903428a00b001ac4a41d38dmr13144028plb.51.1684862448641; Tue, 23 May 2023 10:20:48 -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 o18-20020a170902d4d200b001ae44e2f425sm7007182plg.223.2023.05.23.10.20.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 10:20:48 -0700 (PDT) Date: Tue, 23 May 2023 10:20:47 -0700 From: Kees Cook To: Azeem Shaikh Cc: Qiang Zhao , linux-hardening@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, Li Yang , linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH] soc: fsl: qe: Replace all non-returning strlcpy with strscpy Message-ID: <202305231020.37C95FD@keescook> References: <20230523021425.2406309-1-azeemshaikh38@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230523021425.2406309-1-azeemshaikh38@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_102051_574933_A44B3A90 X-CRM114-Status: GOOD ( 11.99 ) 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 Tue, May 23, 2023 at 02:14:25AM +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