From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753328AbdG2CdG (ORCPT ); Fri, 28 Jul 2017 22:33:06 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:10800 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753159AbdG2CdF (ORCPT ); Fri, 28 Jul 2017 22:33:05 -0400 From: Weilong Chen To: CC: , Subject: [PATCH] ipmi: fix unsigned long overflow Date: Sat, 29 Jul 2017 10:42:41 +0800 Message-ID: <1501296161-74544-1-git-send-email-chenweilong@huawei.com> X-Mailer: git-send-email 2.5.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.101.78] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A020206.597BF3E0.0059,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=0.0.0.0, so=2014-11-16 11:51:01, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 107c5e5290a0785bd30083b9d0910c78 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I set the timeout to a specific value such as 500ms, the timeout event will not happen in time due to the overflow in function check_msg_timeout: ... ent->timeout -= timeout_period; if (ent->timeout > 0) return; ... The type of timeout_period is long, but ent->timeout is unsigned long. This patch makes the type consistent. Signed-off-by: Weilong Chen --- drivers/char/ipmi/ipmi_msghandler.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 810b138..4c806e9 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c @@ -135,8 +135,8 @@ struct seq_table { unsigned int inuse : 1; unsigned int broadcast : 1; - unsigned long timeout; - unsigned long orig_timeout; + long timeout; + long orig_timeout; unsigned int retries_left; /* -- 1.8.3.1