From mboxrd@z Thu Jan 1 00:00:00 1970 From: Joe Perches Subject: Re: [PATCH v5 3/3] PM: Introduce Intel PowerClamp Driver Date: Thu, 03 Jan 2013 19:51:04 -0800 Message-ID: <1357271464.5452.31.camel@joe-AO722> References: <1357225804-27191-1-git-send-email-jacob.jun.pan@linux.intel.com> <1357225804-27191-4-git-send-email-jacob.jun.pan@linux.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit Return-path: Received: from perches-mx.perches.com ([206.117.179.246]:51268 "EHLO labridge.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754187Ab3ADDvG (ORCPT ); Thu, 3 Jan 2013 22:51:06 -0500 In-Reply-To: <1357225804-27191-4-git-send-email-jacob.jun.pan@linux.intel.com> Sender: linux-pm-owner@vger.kernel.org List-Id: linux-pm@vger.kernel.org To: Jacob Pan Cc: Linux PM , LKML , Rafael Wysocki , Len Brown , Thomas Gleixner , "H. Peter Anvin" , Ingo Molnar , Zhang Rui , Rob Landley , Arjan van de Ven , Paul McKenney On Thu, 2013-01-03 at 07:10 -0800, Jacob Pan wrote: > Intel PowerClamp driver performs synchronized idle injection across > all online CPUs. The goal is to maintain a given package level C-state > ratio. [] > +static int window_size_set(const char *arg, const struct kernel_param *kp) > +{ > + int ret = 0; > + unsigned long new_window_size; > + > + ret = kstrtoul(arg, 10, &new_window_size); > + if (ret) > + goto exit_win; > + if (new_window_size > 10 || new_window_size < 2) { > + pr_err("Invalid window size %lu, between 2-10\n", > + new_window_size); > + ret = -EINVAL; > + } > + > + window_size = new_window_size; Possible assignment of known invalid windows size? Maybe you should add goto exit; after ret = -EINVAL; or add new_window_size = clamp(new_window_size, 2ul, 10ul);