Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3926568yba; Sun, 12 May 2019 00:46:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqxpYlOReTx5k7aOjdhNP3MChNKbdBWUWnW3TX/HJ3t2phvw7LaaIxC+uuSCP490ApactIDd X-Received: by 2002:a17:902:1d4a:: with SMTP id u10mr23643842plu.272.1557647216135; Sun, 12 May 2019 00:46:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557647216; cv=none; d=google.com; s=arc-20160816; b=Byciq44YbZfyI6zctc35WkJy0WnYZXFThUjAUOgLuddENiKLdvWDegdvcszV2XA8HW 3b4bkKDM+uZqr/IV9jeJaQ9HO+Mq5+P9AUuR+n9us2a2frWo9eFealdEjXHvSzeQuYB3 eNMs1gIl5C/lzCucZvajMSBDwwoIZj/lWcvYyLYo9m4k40j0jZ37LVckytIVtVvNvRwt 8Z8V6TCTw2+yFpUXm/XtQQnpY8gybW+t/7ND08gYfMV59mqy5NMstnoFqY9hyhtBnt39 7ZYp6EsyQC2oqgqGJ/TXrYztQIKHZ9fUhs+W3qCokXVWhwsvbnydEWAUROI+PJSvyzJP UqxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:date:cc:to:from:subject:organization; bh=WC5oysLInfIQDdFXh9kmv/cusa67hD82AGHseq8jdpc=; b=059OIdDIvTUKcOiHXbrz3JLmSgtboFzpKVMU1IjRM6WFTquRepwOUJwOWchi0iL/5i gT3X/9KsmoOl3PjLZFmRzO1A9SlypRD9zUPBLH8EmvmBGjJ0fbKljT3ddA5P9DcjRm/5 qt+R0cux3F9DTeS21aHMlL57abJiM49sp/FWXPMRz6WRccCu8cQ0F1O5ctpttn3hUBtE uqQSOkLYHbyultuUGgil4MzCk0XW5gYu3uNeyldcJbqRI9KZVQ+V4/C1W2cqNDhRaUBM cMD6ur8sQT0vOyB6DqhOlvE3T7nCRq4sExLBOKf4kzDk7lRQBES/Qkb2YQkMubhkriFi ogCg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24si14306149pgt.474.2019.05.12.00.46.39; Sun, 12 May 2019 00:46:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726375AbfELHpo (ORCPT + 99 others); Sun, 12 May 2019 03:45:44 -0400 Received: from mx1.redhat.com ([209.132.183.28]:34358 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725913AbfELHpn (ORCPT ); Sun, 12 May 2019 03:45:43 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 79CFC85541; Sun, 12 May 2019 07:45:43 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-61.rdu2.redhat.com [10.10.120.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id E3DB5100164A; Sun, 12 May 2019 07:45:41 +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 Subject: [PATCH 1/2] afs: Fix incorrect error handling in afs_xattr_get_acl() From: David Howells To: colin.king@canonical.com Cc: Joe Perches , joe@perches.com, jaltman@auristor.com, linux-afs@lists.infradead.org, dhowells@redhat.com, kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Date: Sun, 12 May 2019 08:45:41 +0100 Message-ID: <155764714099.24080.1233326575922058381.stgit@warthog.procyon.org.uk> User-Agent: StGit/unknown-version MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Sun, 12 May 2019 07:45:43 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Fix incorrect error handling in afs_xattr_get_acl() where there appears to be a redundant assignment before return, but in fact the return should be a goto to the error handling at the end of the function. Fixes: 260f082bae6d ("afs: Get an AFS3 ACL as an xattr") Addresses-Coverity: ("Unused Value") Reported-by: Colin Ian King Signed-off-by: David Howells cc: Joe Perches --- fs/afs/xattr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/afs/xattr.c b/fs/afs/xattr.c index c81f85003fc7..b6c44e75b361 100644 --- a/fs/afs/xattr.c +++ b/fs/afs/xattr.c @@ -71,11 +71,10 @@ static int afs_xattr_get_acl(const struct xattr_handler *handler, if (ret == 0) { ret = acl->size; if (size > 0) { - ret = -ERANGE; - if (acl->size > size) - return -ERANGE; - memcpy(buffer, acl->data, acl->size); - ret = acl->size; + if (acl->size <= size) + memcpy(buffer, acl->data, acl->size); + else + ret = -ERANGE; } kfree(acl); }