From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933833AbcDEWR4 (ORCPT ); Tue, 5 Apr 2016 18:17:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:55280 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933737AbcDEWRy (ORCPT ); Tue, 5 Apr 2016 18:17:54 -0400 Date: Tue, 5 Apr 2016 15:17:52 -0700 From: Andrew Morton To: Andy Shevchenko Cc: Dmitry Kasatkin , Mimi Zohar , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Rasmus Villemoes , linux-efi@vger.kernel.org, Matt Fleming , Arnd Bergmann , "Theodore Ts'o" Subject: Re: [PATCH v3 06/10] sysctl: drop away useless label Message-Id: <20160405151752.de82f221f1c70ff901b2b958@linux-foundation.org> In-Reply-To: <1459864579-55988-7-git-send-email-andriy.shevchenko@linux.intel.com> References: <1459864579-55988-1-git-send-email-andriy.shevchenko@linux.intel.com> <1459864579-55988-7-git-send-email-andriy.shevchenko@linux.intel.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 5 Apr 2016 16:56:15 +0300 Andy Shevchenko wrote: > We have no locking in bin_uuid(). Thus, we may remove the out label and use > return statements directly. > > ... > > --- a/kernel/sysctl_binary.c > +++ b/kernel/sysctl_binary.c > @@ -1123,15 +1123,14 @@ static ssize_t bin_uuid(struct file *file, > > result = kernel_read(file, 0, buf, sizeof(buf) - 1); > if (result < 0) > - goto out; > + return result; > > buf[result] = '\0'; > > /* Convert the uuid to from a string to binary */ > for (i = 0; i < 16; i++) { > - result = -EIO; > if (!isxdigit(str[0]) || !isxdigit(str[1])) > - goto out; > + return -EIO; > > uuid[i] = (hex_to_bin(str[0]) << 4) | > hex_to_bin(str[1]); > @@ -1143,15 +1142,12 @@ static ssize_t bin_uuid(struct file *file, > if (oldlen > 16) > oldlen = 16; > > - result = -EFAULT; > if (copy_to_user(oldval, uuid, oldlen)) > - goto out; > + return -EFAULT; > > copied = oldlen; > } > - result = copied; > -out: > - return result; > + return copied; > } Sure, but we may add locking or resource allocation in the future, in which case this change will need to be undone. I think it's better to leave the code as-is. It's presently quite typical kernel code.