Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp4203205rwb; Tue, 20 Sep 2022 10:12:11 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5dvU/P9d+hdqbIw8mHf0ronR+YjkrkGH9zEqYFAZzm/rN26JtQzIlZv+vBrsndpy3xlh0Y X-Received: by 2002:a17:90b:4a0c:b0:202:b4ed:1a2b with SMTP id kk12-20020a17090b4a0c00b00202b4ed1a2bmr4841027pjb.67.1663693931102; Tue, 20 Sep 2022 10:12:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663693931; cv=none; d=google.com; s=arc-20160816; b=SwFdjUUuqPM6EhQY907DtusMAyV9/9ZQJ+EvYoKa4ERapN1xOCQWCDC7kBxZjAKOBe b76N/TjLar33KlJCgPzmxpVhu+agrodEqn0+ahvEypQBzwaHmCrN8wtqtghfZ3uGabAL wQvZQeYkqJrTIvNJ1l0G79r1DAZr7Qrh7MHqsBkUkNXVfV4wEGNoEhepl3yPz58Uu0Qi wvAkwJ3adPZY6CzDBLmJEtdWCX44Wye0GCXGU2VFCkrVQnRSjtJ+8lSmWkuztlU+N/bK +7JDUvOuK8rnHtDHvcdRhbogDe6tbK6kiPnG3NohuLwWSc4SA/y2nL5x4meLMr+Fu66Z x9Gg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=aEdsOHzjH97z17SptNiw9CXuDPhFZexmtyDdyOGwyRE=; b=Ki/XvFHUYfny1rgbT2vytzNIN+1ngA7eaCMboV346Karcx5YxJbQwRv6SszuIKq4R4 zq7OwGW41MjoxwIzKeaISCFWJwP01h7jdR9O8/Ku/BYsOo4KWUCnlGR1mAByueqZBSzj H/53ysc9d+r5/eFaVrroNRgSzsBt4GlpohbOlnFPOtiLWO6ImAvCtMuT5Sq4i+Ovqu95 BIgCNfBWpCZPBL7YEaW8tFywrUrrpddrsUC+x4OQBvYgpZ4xsgGfYZBTh+W3CKEy4oyY 4kv1SsFUkPWX3kMfLAMAaVUj5zpIMtbz6uxYVw/+p44pMNEHE+fiH0XPMdtlYbHmK8o6 8R1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=FEAo2CYl; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e7-20020a17090a9a8700b00200bbb9027asi263382pjp.77.2022.09.20.10.11.59; Tue, 20 Sep 2022 10:12:11 -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=@kernel.org header.s=k20201202 header.b=FEAo2CYl; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231438AbiITQo7 (ORCPT + 99 others); Tue, 20 Sep 2022 12:44:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60150 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231408AbiITQo4 (ORCPT ); Tue, 20 Sep 2022 12:44:56 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9108213E27; Tue, 20 Sep 2022 09:44:55 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2B56562B4F; Tue, 20 Sep 2022 16:44:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 868C8C43470; Tue, 20 Sep 2022 16:44:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663692294; bh=XIsRykKdGIJ+RZITE67y/5dHz3YGRh/z9EWZg+FrivU=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=FEAo2CYlL6TCfxwNk8R5Lka/RkflGNBbITwbG1b/FazyvOnhLu1xtwrlvPRtmupyh ySLDDROfDB0eNBuL+Pls/96mWcf485xPBBQIVMYf1X2W0a+yyGbfepDuy1ymti/uam Rph92vC78UZ3C2oTp2sogjDjWr/C+JhZDeUoZDZJiW41MMA3EdWo0edcI9MwvYYmFx wQ6NBe7wheZDi+8pcLRSBdkXuGjA3m3C5JyvBEX2GoXNfCEc4iFYpnEmQnGPl83FRQ FmooEIsC2pjM8Vw+XqfHe2PPW+UMI/1VOtg6BlI3pF1PgUL9OyS+grLoooXEed6+SU uUQZeulUXhdSw== Received: by mail-lf1-f50.google.com with SMTP id j16so4797303lfg.1; Tue, 20 Sep 2022 09:44:54 -0700 (PDT) X-Gm-Message-State: ACrzQf2/FzE3EUQUxb6PvATgI8F8dRt9Igl2+g/QPc4akmoa1IDckRw7 B/HEnZXiwSDMcu8AKsGOgNx5GFj3w0ANnZ3OpxE= X-Received: by 2002:a05:6512:ba1:b0:498:9890:1bb4 with SMTP id b33-20020a0565120ba100b0049898901bb4mr7983242lfv.122.1663692292587; Tue, 20 Sep 2022 09:44:52 -0700 (PDT) MIME-Version: 1.0 References: <20220909194214.186731-1-gpiccoli@igalia.com> <04d65bd7-a6b2-bb14-fd69-632542ae9e86@wanadoo.fr> In-Reply-To: From: Ard Biesheuvel Date: Tue, 20 Sep 2022 18:44:40 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH V2] efi: efibc: Guard against allocation failure To: "Guilherme G. Piccoli" Cc: Christophe JAILLET , linux-efi@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-dev@igalia.com, kernel@gpiccoli.net, matt@codeblueprint.co.uk, mjg59@srcf.ucam.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Sun, 11 Sept 2022 at 16:36, Guilherme G. Piccoli wrote: > > On 10/09/2022 01:56, Christophe JAILLET wrote: > > [...] > >> wdata = kmalloc(MAX_DATA_LEN * sizeof(efi_char16_t), GFP_KERNEL); > > Hi, > > > > even if mostly useless in this case, kmalloc_array()? > > > > Or certainly maybe even better, kstrndup()? > > > > CJ > > > > Thanks! It's up to Ard, I could rework with this change if makes sense. > Cheers, > kstrndup() does not work on wide strings so I think the code is fine as is. I've queued it as a fix - thanks.