From patchwork Tue Sep 2 14:13:32 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4826121 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DA801C0338 for ; Tue, 2 Sep 2014 14:14:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CED1B2009C for ; Tue, 2 Sep 2014 14:14:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B3FC62017E for ; Tue, 2 Sep 2014 14:14:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753586AbaIBOOA (ORCPT ); Tue, 2 Sep 2014 10:14:00 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:50031 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753522AbaIBOOA (ORCPT ); Tue, 2 Sep 2014 10:14:00 -0400 Received: by mail-pd0-f181.google.com with SMTP id fp1so8792245pdb.12 for ; Tue, 02 Sep 2014 07:14:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; bh=kYcSIWmERqy6EQV49GDengdpIpTWcxzAQxKm4QB3lds=; b=k1ugU9YAKI+cgMthp1FxRAI7drIjcKWk/7qOF4IxO0V7duuGJJb0+T+4+ALFdQf94s 7gs5q0/b3P/7VlL4JFcXEd/+3yhAF+Q4CnZE9doV41mJpiNVA8D/840nEUO1aeIWklg4 fVHphZ+7DH6Nf7RfdR2dGC+iQB6dnne4qnmqWlsdYjdC0pRyarfbYPihfrxPt4yVqd6U otMKwIEVjbnCZikw/SnvFkD5nwGiehSIHTOQFD+/YP5FJnf89ziDuglZqQB1R/QIONxD 2OEIFwf6mwWwry4XfOcYictkU1fLUIq6i+GELRRoNhkCynCJpNUB8vozJpMsh8V66mvq 5a+Q== X-Received: by 10.68.239.201 with SMTP id vu9mr48145052pbc.35.1409667240049; Tue, 02 Sep 2014 07:14:00 -0700 (PDT) Received: from [192.168.0.100] ([171.92.20.104]) by mx.google.com with ESMTPSA id ff10sm5663894pdb.61.2014.09.02.07.13.56 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 02 Sep 2014 07:13:59 -0700 (PDT) Message-ID: <5405D08C.8060609@gmail.com> Date: Tue, 02 Sep 2014 22:13:32 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , Kinglong Mee Subject: [PATCH 4/6] NFSD: Fix bad using of return value from qword_get Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Kinglong Mee --- fs/nfsd/nfs4idmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/nfsd/nfs4idmap.c b/fs/nfsd/nfs4idmap.c index a0ab0a8..dc948f6 100644 --- a/fs/nfsd/nfs4idmap.c +++ b/fs/nfsd/nfs4idmap.c @@ -368,7 +368,7 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen) { struct ent ent, *res; char *buf1; - int error = -EINVAL; + int len, error = -EINVAL; if (buf[buflen - 1] != '\n') return (-EINVAL); @@ -392,8 +392,8 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen) IDMAP_TYPE_USER : IDMAP_TYPE_GROUP; /* Name */ - error = qword_get(&buf, buf1, PAGE_SIZE); - if (error <= 0 || error >= IDMAP_NAMESZ) + len = qword_get(&buf, buf1, PAGE_SIZE); + if (len <= 0 || len >= IDMAP_NAMESZ) goto out; memcpy(ent.name, buf1, sizeof(ent.name));