Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752864AbdLFOug (ORCPT ); Wed, 6 Dec 2017 09:50:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49054 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbdLFOuX (ORCPT ); Wed, 6 Dec 2017 09:50:23 -0500 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: References: <20171204181424.15808-1-colin.king@canonical.com> To: James Morris Cc: dhowells@redhat.com, Colin King , "Serge E . Hallyn" , keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] security: keys: remove redundant assignment to key_ref MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <15712.1512571817.1@warthog.procyon.org.uk> Date: Wed, 06 Dec 2017 14:50:17 +0000 Message-ID: <15713.1512571817@warthog.procyon.org.uk> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 06 Dec 2017 14:50:22 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 669 Lines: 24 James Morris wrote: > I think a general cleanup in that function to make all of these follow the > pattern: > > if (something) { > key_ref = ERR_PTR(-error); > goto error; > } > > rather than unconditionally setting the error first, would be better, but > this is a clear enough fix on its own. There's a preference in Linux to use: key_ref = ERR_PTR(-error); if (something) goto error; instead because it uses less vertical space. It might originally have been promulgated by Linus, but I don't remember. Though you do have a point - your way makes error handling less subject breakage from code rearrangement. David