From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965082AbbGHIcc (ORCPT ); Wed, 8 Jul 2015 04:32:32 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:25222 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933662AbbGHI3M (ORCPT ); Wed, 8 Jul 2015 04:29:12 -0400 Date: Wed, 8 Jul 2015 11:28:37 +0300 From: Dan Carpenter To: green@linuxhacker.ru Cc: Greg Kroah-Hartman , devel@driverdev.osuosl.org, Andreas Dilger , Linux Kernel Mailing List Subject: Re: [PATCH 15/20] staging/lustre/libcfs: get rid of debugfs/lnet/console_backoff Message-ID: <20150708082837.GL4341@mwanda> References: <1436201338-14263-1-git-send-email-green@linuxhacker.ru> <1436201338-14263-16-git-send-email-green@linuxhacker.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1436201338-14263-16-git-send-email-green@linuxhacker.ru> User-Agent: Mutt/1.5.21 (2010-09-15) X-Source-IP: aserv0021.oracle.com [141.146.126.233] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 06, 2015 at 12:48:53PM -0400, green@linuxhacker.ru wrote: > +static int param_set_uint_minmax(const char *val, > + const struct kernel_param *kp, > + unsigned int min, unsigned int max) > +{ > + unsigned int num; > + int ret; > + > + if (!val) > + return -EINVAL; > + ret = kstrtouint(val, 0, &num); > + if (ret == -EINVAL || num < min || num > max) ^^^ Smatch is smart enough to know that "num" can be uninitialized here on some paths. It doesn't generate a warning yet because a lot of the kernel has error paths where we mostly assume things won't fail. It should probably be: ret = kstrtouint(val, 0, &num); if (ret) return ret; if (num < min || num > max) return -EINVAL; > + return -EINVAL; > + *((unsigned int *)kp->arg) = num; > + return 0; > +} regards, dan carpenter