From patchwork Fri Jul 6 19:31:56 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eldad Zack X-Patchwork-Id: 1167161 Return-Path: X-Original-To: patchwork-linux-nfs@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 113723FC2A for ; Fri, 6 Jul 2012 19:32:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757611Ab2GFTcZ (ORCPT ); Fri, 6 Jul 2012 15:32:25 -0400 Received: from mail-bk0-f46.google.com ([209.85.214.46]:34804 "EHLO mail-bk0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757567Ab2GFTcY (ORCPT ); Fri, 6 Jul 2012 15:32:24 -0400 Received: by bkwj10 with SMTP id j10so4699647bkw.19 for ; Fri, 06 Jul 2012 12:32:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=RxnrWNCOti9IJ+zzlP0XweYvhmCBcoPxIs93B+/nkto=; b=Zj/I+kRl27BUdG+6m0T5MLkes0fBPWSpUW9Ih99roXWQXRPuHRomRUcrlbQIN+k9Dh nNdi0IAA25oaQfYZgOtvByru3HG+ks6F30cMmIDw0i5ES5BnbLRSWXUKNpmsrAH3J3tp NiVhJzF/UOR06taiNopTMF9XMz4LTguwcTpO7tkV2kcmBtZpFH1t9ARb/ZCnqbvjfcDH pdQJV5MMjCkJmR+ZdBFqD4wOn2YzWbjrmQ7dXo6/GL6AZE/nYOP/SB/VvijKyI1wycIv FiJk4jwCXZLWeQyrwom3L9S9WELGXBCpCkNqubNcdl4ALIXp0tZsSrpILsZpuLEXnvJx y2ww== Received: by 10.205.119.210 with SMTP id fv18mr5370629bkc.10.1341603143319; Fri, 06 Jul 2012 12:32:23 -0700 (PDT) Received: from localhost (p5DDC5275.dip.t-dialin.net. [93.220.82.117]) by mx.google.com with ESMTPS id 6sm3441389bka.12.2012.07.06.12.32.21 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 06 Jul 2012 12:32:22 -0700 (PDT) From: Eldad Zack To: "J. Bruce Fields" , Trond Myklebust Cc: Joe Perches , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, Eldad Zack Subject: [PATCH 1/2, resend] sunrpc/cache.h: fix coding style Date: Fri, 6 Jul 2012 21:31:56 +0200 Message-Id: <1341603117-13064-1-git-send-email-eldad@fogrefinery.com> X-Mailer: git-send-email 1.7.10 X-Gm-Message-State: ALoCoQkihnhvmH1IBz9CvZIaUR4w/VFnzKEK/WKlZGavMJP/IB1UZqaCsBkRcYFZNryixBxfsevF Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Neaten code style in get_int(). Also use sizeof() instead of hard coded number as suggested by Joe Perches . Cc: Joe Perches Signed-off-by: Eldad Zack --- Resent to include improvements from Joe Perches. include/linux/sunrpc/cache.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/linux/sunrpc/cache.h b/include/linux/sunrpc/cache.h index f5fd616..6def1f6 100644 --- a/include/linux/sunrpc/cache.h +++ b/include/linux/sunrpc/cache.h @@ -219,11 +219,17 @@ static inline int get_int(char **bpp, int *anint) char buf[50]; char *ep; int rv; - int len = qword_get(bpp, buf, 50); - if (len < 0) return -EINVAL; - if (len ==0) return -ENOENT; + int len = qword_get(bpp, buf, sizeof(buf)); + + if (len < 0) + return -EINVAL; + if (len == 0) + return -ENOENT; + rv = simple_strtol(buf, &ep, 0); - if (*ep) return -EINVAL; + if (*ep) + return -EINVAL; + *anint = rv; return 0; }