From patchwork Wed Jun 25 11:01:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kinglong Mee X-Patchwork-Id: 4419531 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 807989F26E for ; Wed, 25 Jun 2014 11:02:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id EC2BE20254 for ; Wed, 25 Jun 2014 11:02:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0F9AC201EF for ; Wed, 25 Jun 2014 11:02:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752641AbaFYLCV (ORCPT ); Wed, 25 Jun 2014 07:02:21 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:40728 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbaFYLCU (ORCPT ); Wed, 25 Jun 2014 07:02:20 -0400 Received: by mail-pa0-f41.google.com with SMTP id fb1so1590177pad.28 for ; Wed, 25 Jun 2014 04:02:20 -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=opNr49G0xDtzAWpaBCFp04HXebi20034Rb8e1hhvmavYhyzKIExLBe2J3KqnIfjifx j1Zkv/DurJV6H+dcjnbEfzwdvsAPqlIYtW+cIYQ+y9uURDCojk5jYdrxKf+e4agHvvRU 1dFyQh6zIOci+3OdYjjh0lawKb9vB4KFFT7dRA+5fW3kvaHwu4567IEbw7pKs8befRBJ KaMM+CrDdG4ywPMOITlY809pk4PMTNJAXiOSDAni+xsyrD0aJY2dapq6IEimhrAbqN7n 1AtCqTdqv4feABxH19wqYbVV0hz/04jEiPKSNZkE5yjm1OMm9r+1whVjgr8r/4oRXXOD hpIg== X-Received: by 10.68.200.10 with SMTP id jo10mr10123264pbc.143.1403694140033; Wed, 25 Jun 2014 04:02:20 -0700 (PDT) Received: from [192.168.0.100] ([171.215.227.43]) by mx.google.com with ESMTPSA id qf10sm4743545pbc.23.2014.06.25.04.02.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 25 Jun 2014 04:02:18 -0700 (PDT) Message-ID: <53AAAC23.90201@gmail.com> Date: Wed, 25 Jun 2014 19:01:55 +0800 From: Kinglong Mee User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 MIME-Version: 1.0 To: "J. Bruce Fields" CC: Linux NFS Mailing List , kinglongmee@gmail.com Subject: [PATCH 3/4] 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=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, 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));