From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935196AbcJQPVx (ORCPT ); Mon, 17 Oct 2016 11:21:53 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:35301 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933143AbcJQPVo (ORCPT ); Mon, 17 Oct 2016 11:21:44 -0400 Date: Tue, 18 Oct 2016 00:20:43 +0900 From: Sergey Senozhatsky To: Sergey Senozhatsky Cc: "Rafael J . Wysocki" , Viresh Kumar , Aaro Koskinen , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Sergey Senozhatsky Subject: Re: [PATCH] cpufreq: fix overflow in cpufreq_table_find_index_dl() Message-ID: <20161017152043.GA502@swordfish> References: <20161017151456.3573-1-sergey.senozhatsky@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20161017151456.3573-1-sergey.senozhatsky@gmail.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (10/18/16 00:14), Sergey Senozhatsky wrote: [..] > include/linux/cpufreq.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h > index 5fa55fc..2a7aa0b 100644 > --- a/include/linux/cpufreq.h > +++ b/include/linux/cpufreq.h > @@ -677,10 +677,10 @@ static inline int cpufreq_table_find_index_dl(struct cpufreq_policy *policy, > if (best == table - 1) > return pos - table; > > - return best - pos; > + return pos - best; > } > > - return best - pos; > + return pos - best; > } hmm.., you know what... I'm now actually curious, why does it do `pos - best' and not `best - table'? -ss