From patchwork Thu Jul 12 12:29:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Carpenter X-Patchwork-Id: 10521643 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id AFED7602B3 for ; Thu, 12 Jul 2018 12:29:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99277293AE for ; Thu, 12 Jul 2018 12:29:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D718293B1; Thu, 12 Jul 2018 12:29:45 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34F60293AE for ; Thu, 12 Jul 2018 12:29:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726810AbeGLMjF (ORCPT ); Thu, 12 Jul 2018 08:39:05 -0400 Received: from userp2130.oracle.com ([156.151.31.86]:45196 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726663AbeGLMjF (ORCPT ); Thu, 12 Jul 2018 08:39:05 -0400 Received: from pps.filterd (userp2130.oracle.com [127.0.0.1]) by userp2130.oracle.com (8.16.0.22/8.16.0.22) with SMTP id w6CCTCVP174194; Thu, 12 Jul 2018 12:29:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : mime-version : content-type; s=corp-2018-07-02; bh=VZtnlllM7rDcl2Qb6abjZA7GqZsuD/8R0mo6j1nnres=; b=gy9601zOOGqpLOMnoXrFVhCz72r5Pe8UGJzvPfRYmE7dSe16in4mC1uO0L15+GBhbTjR DQ+iLIk5bh6yQbDZe49DOWXhtd1n/NQ8yThK9DBgBy0NNrZOSlFNqhyniK75uNh1iC38 pWp/izyUN4P+5EflbJwsdjrJQPkiFmmY3U9jC4pezAWqZbeBY00enMyFQ6ZMKN1pWcUo jtPJcwLI0y/Vb2IBrYNPIb1KM7PdXxXGxukgHfZCkSbToT0S8R09WLZfs8AmThxp0dDP cdn6XrixgTxV5hx0e5ZOLJTulb+dqkU2TpKWQU4B3HAx/OtjqUDn1NYutPAES96JK78k Hw== Received: from aserv0021.oracle.com (aserv0021.oracle.com [141.146.126.233]) by userp2130.oracle.com with ESMTP id 2k2p76bf41-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jul 2018 12:29:40 +0000 Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by aserv0021.oracle.com (8.14.4/8.14.4) with ESMTP id w6CCTb7d010200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 12 Jul 2018 12:29:38 GMT Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id w6CCTbXl006792; Thu, 12 Jul 2018 12:29:37 GMT Received: from kili.mountain (/41.202.241.62) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Thu, 12 Jul 2018 12:29:36 +0000 Date: Thu, 12 Jul 2018 15:29:29 +0300 From: Dan Carpenter To: Trond Myklebust Cc: Anna Schumaker , linux-nfs@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: [PATCH] NFS: silence a harmless uninitialized variable warning Message-ID: <20180712122929.dshlwi3obipq6vfm@kili.mountain> MIME-Version: 1.0 Content-Disposition: inline X-Mailer: git-send-email haha only kidding User-Agent: NeoMutt/20170113 (1.7.2) X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8951 signatures=668706 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=663 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1806210000 definitions=main-1807120131 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP kstrtoul() can return -ERANGE so Smatch complains that "num" can be uninitialized. We check that it's within bounds so it's not a huge deal. Signed-off-by: Dan Carpenter --- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/fs/nfs/super.c b/fs/nfs/super.c index b5f27d6999e5..d81a33461bee 100644 --- a/fs/nfs/super.c +++ b/fs/nfs/super.c @@ -2901,7 +2901,7 @@ static int param_set_portnr(const char *val, const struct kernel_param *kp) if (!val) return -EINVAL; ret = kstrtoul(val, 0, &num); - if (ret == -EINVAL || num > NFS_CALLBACK_MAXPORTNR) + if (ret || num > NFS_CALLBACK_MAXPORTNR) return -EINVAL; *((unsigned int *)kp->arg) = num; return 0;