From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Howells Date: Wed, 06 Dec 2017 14:50:17 +0000 Subject: Re: [PATCH] security: keys: remove redundant assignment to key_ref Message-Id: <15713.1512571817@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit List-Id: References: <20171204181424.15808-1-colin.king@canonical.com> In-Reply-To: To: linux-security-module@vger.kernel.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 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 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: dhowells@redhat.com (David Howells) Date: Wed, 06 Dec 2017 14:50:17 +0000 Subject: [PATCH] security: keys: remove redundant assignment to key_ref In-Reply-To: References: <20171204181424.15808-1-colin.king@canonical.com> Message-ID: <15713.1512571817@warthog.procyon.org.uk> To: linux-security-module@vger.kernel.org List-Id: linux-security-module.vger.kernel.org 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 -- To unsubscribe from this list: send the line "unsubscribe linux-security-module" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html