Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1123667ybh; Thu, 23 Jul 2020 00:35:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxLZInoy6GXh7OghXvQ3GHeOlioFtMFbE2STgJzNZ4xyaoLEWdSpERfT7xligTQk28dT6+u X-Received: by 2002:a17:906:f298:: with SMTP id gu24mr3111150ejb.302.1595489732182; Thu, 23 Jul 2020 00:35:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595489732; cv=none; d=google.com; s=arc-20160816; b=r+g5apUGTJ8zm5OG8ye0t5IClWMcYQKVocHy6isXs6LQWF93MmkHt/P3cV/3g3Zxbh AJ1pVfwfB5iuK+HBHVGn7k5/pF3RA8vUR7/LjUU4HdmdhkLnnDdQu5pY9bU9GGqNqD1d t4QTLSSJ7C1EDiAC67eFa54s5++P3uF3Zv9yvwWej9kOg6eEWoCaNiJ3ufa8nDhARNno R9bAeFP9MkpTQypC6Qql+jqFC3e2XFRHx4VCAq4BsqM6hQ9T5cvnJJWXcIzx68IXHZg1 +uTZlkLztvvCOGRTtct4CU6MISZ+h9DUU4jUK4GKpMdTK2KCXVGSDfRh3cJgGLTkQOVR woRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:content-id:mime-version :subject:cc:to:references:in-reply-to:from:organization :dkim-signature; bh=jQHRUT5gixVlpLT/vMX5zI5kpeZwUfmxkJZjL4H/0xo=; b=iGngM1AafX+FZWP87Fhi3rvDPDy9a+IoLIJqusxUcXI8OJuy5661jBf6+meg2K4nFj zYK1lrnMTLFZdguCL2xynvfRi55uGGcv9qd98fZzh7OhU8xTXNgdzhct+49CU2pp1Ch2 k+uTOOnk8ATWFRq62FjolQDu8b/c52dNqzyEqo7xU3q0DWq5APysDdbkCPcyehqja2jH 8MB9YYQBr7k7uIcBSjD4fqd8Eqj21wIqMj7tU6tY5Qo27Opa3ih6B+SHPC0RRGS13NM1 ai8t03jL56R+83/jvmHYVN91XXP7OIO2yFPlPJ6e8WgOKmqcA0b4ToHpQ3zNqyJiQvoS 5pBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="RwH8P6N/"; 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 de9si1449077edb.404.2020.07.23.00.35.09; Thu, 23 Jul 2020 00:35:32 -0700 (PDT) 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="RwH8P6N/"; 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 S1726994AbgGWHbe (ORCPT + 99 others); Thu, 23 Jul 2020 03:31:34 -0400 Received: from us-smtp-delivery-1.mimecast.com ([207.211.31.120]:39555 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726941AbgGWHbd (ORCPT ); Thu, 23 Jul 2020 03:31:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1595489493; 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=jQHRUT5gixVlpLT/vMX5zI5kpeZwUfmxkJZjL4H/0xo=; b=RwH8P6N/chxJglaYQov6QaZMxT1HirNbA2zNVIqGG/IX9B9BHj0qvfCY4BiMv1GQHOE4rj gzSJCrEaQ2N9RYtVv1Y/Bmy6jJmvZcf/igDX65w7DyxeiDsyv1psCPPnpu+DsbiTiCpdVP LcfkWddiPjq4EVqIIWjnXMhqABeN45Y= 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-425-IvtNbOVbOpabky9s9I6Xow-1; Thu, 23 Jul 2020 03:31:27 -0400 X-MC-Unique: IvtNbOVbOpabky9s9I6Xow-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 91A3657; Thu, 23 Jul 2020 07:31:25 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-112-32.rdu2.redhat.com [10.10.112.32]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1A4BC61176; Thu, 23 Jul 2020 07:31:23 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells In-Reply-To: <20200723013223.GA45081@linux.intel.com> References: <20200723013223.GA45081@linux.intel.com> <159485211858.2340757.9890754969922775496.stgit@warthog.procyon.org.uk> To: Jarkko Sakkinen Cc: dhowells@redhat.com, torvalds@linux-foundation.org, Wei Yongjun , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] keys: asymmetric: fix error return code in software_key_query() MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1267852.1595489483.1@warthog.procyon.org.uk> Date: Thu, 23 Jul 2020 08:31:23 +0100 Message-ID: <1267853.1595489483@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Jarkko Sakkinen wrote: > > if (IS_ERR(tfm)) > > return PTR_ERR(tfm); > > > > + ret = -ENOMEM; > > This is extremely confusing to read way to handle 'ret'. > > Would be way more cleaner to be just simple and stupid: > > if (!key) { > ret = -ENOMEM; > goto error_free_tfm; > } I agree, but we have some people who will (or who used to) moan at you for doing in four lines what you could've done in three. I don't know if this is still the standard. David