Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp4797557pxu; Thu, 10 Dec 2020 05:51:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyHZw2sNDgn0eFJXmdsDMMaqpgPZ1dPtpGD7Jl4FwZH7geP0sD8SPOrFx/9XCo208OS9ZQY X-Received: by 2002:a50:c19a:: with SMTP id m26mr6828449edf.302.1607608304744; Thu, 10 Dec 2020 05:51:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607608304; cv=none; d=google.com; s=arc-20160816; b=r7V4wPsxwH+ym5Ayjca+paLGPu+zHAKUQYew5XLI45ai6Y1wXqJqzBYja2pVIJs7O3 1ZpzeaODJwHGo8mr8Q0uP7mMpGNF7YOW/l37Cs42TusrDBBS29ZLoYJf0SkrE+vRt9RX uu1idbjmkuJWoTo0w2bZSmePqVyLzMYFcAmL8QinDxkkaECxB8fM5Hu13uzH0nPhKT3e qkcdDZSVqNpVhkNlBpSO0Qyr22P1WrafapiT/UyfTdSktd+svgzoUfsYTQLaprU4PWpz 2Rtb5x9Pkg8TMhBqV30MawdVr8Wzzw7j43NvetZvbyurBVxZPEj6/xP43oPLFv+SEHb1 lBjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=bMTsarmZ3rdaAqV3OBcsA5tbkP+r5zT+YS2adqptF7A=; b=iraFmCIILx8VrxBu5v52F+36TtfqENo9mU8sqdMNti+gaCQWQ9QHKrHR+Hzi7SNDa5 mAgQH0TyrNoOOnTyyc8eDJB9wGadW2Mk8IHSQtc7W8eu+8C7waTdUa2rh765dpmC0DBO ymMgoRUcKhlGnmGayW12y5rgWPJPgHvh2xjtztZJCC/r2ZFgEu8ZXfENxkfleHF0RYZX BWsbyK+w/9iHkhPkPxmTfpLxCadKEVQAKlTVqfnKZ1RSe/6q3EZLIo8YlmbdXVvig4wn bkQhmwOvFpOmb4tN5yzG1UqA3djflIpBRrlw8pN2/JFn1ZhbER7eemBdxahpFo+sU0vd BpJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=izhlQsTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t6si2541132ejr.116.2020.12.10.05.51.21; Thu, 10 Dec 2020 05:51:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=izhlQsTR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727637AbgLJCG6 (ORCPT + 99 others); Wed, 9 Dec 2020 21:06:58 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:57162 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727662AbgLJCGo (ORCPT ); Wed, 9 Dec 2020 21:06:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607565918; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=bMTsarmZ3rdaAqV3OBcsA5tbkP+r5zT+YS2adqptF7A=; b=izhlQsTRhuB10B9/QSGB3uSBrCzfOOL+zVFdX6ckrXcg+YI44a1jcUiaQg3pwRZPmVfYwQ /lGydVeXszmT9Uni68gXI+GKNK2VNxVJrGa+/Ui518AE3H+6KvGJB/hT1y45klQ1TmvgWM Zkn7GgpXRGnYDK9jktVZmYHHC5g2xk4= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-139-5XKOH-0oPaCiEVTgP1yXkw-1; Wed, 09 Dec 2020 21:05:16 -0500 X-MC-Unique: 5XKOH-0oPaCiEVTgP1yXkw-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C336B858183; Thu, 10 Dec 2020 02:05:14 +0000 (UTC) Received: from dhcp-128-65.nay.redhat.com (ovpn-13-57.pek2.redhat.com [10.72.13.57]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 57C305C1C4; Thu, 10 Dec 2020 02:05:11 +0000 (UTC) Date: Thu, 10 Dec 2020 10:05:08 +0800 From: Dave Young To: Dan Carpenter Cc: Eric Biederman , kexec@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH] kexec: Fix error code in kexec_calculate_store_digests() Message-ID: <20201210020508.GB2950@dhcp-128-65.nay.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 12/08/20 at 10:55pm, Dan Carpenter wrote: > Return -ENOMEM on allocation failure instead of returning success. > > Fixes: a43cac0d9dc2 ("kexec: split kexec_file syscall code to kexec_file.c") > Signed-off-by: Dan Carpenter > --- > kernel/kexec_file.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/kernel/kexec_file.c b/kernel/kexec_file.c > index b02086d70492..9570f380a825 100644 > --- a/kernel/kexec_file.c > +++ b/kernel/kexec_file.c > @@ -735,8 +735,10 @@ static int kexec_calculate_store_digests(struct kimage *image) > > sha_region_sz = KEXEC_SEGMENT_MAX * sizeof(struct kexec_sha_region); > sha_regions = vzalloc(sha_region_sz); > - if (!sha_regions) > + if (!sha_regions) { > + ret = -ENOMEM; > goto out_free_desc; > + } > > desc->tfm = tfm; > > -- > 2.29.2 > Good catch, thanks! Acked-by: Dave Young Thanks Dave