From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753527AbcADUL7 (ORCPT ); Mon, 4 Jan 2016 15:11:59 -0500 Received: from mail-qg0-f68.google.com ([209.85.192.68]:36491 "EHLO mail-qg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753474AbcADULv (ORCPT ); Mon, 4 Jan 2016 15:11:51 -0500 From: "Geyslan G. Bem" Cc: "Geyslan G. Bem" , linux-kernel@vger.kernel.org, Alan Stern , Greg Kroah-Hartman , linux-usb@vger.kernel.org Subject: [PATCH 07/17] usb: host: ehci-dbg: fix unsigned comparison Date: Mon, 4 Jan 2016 17:09:52 -0300 Message-Id: X-Mailer: git-send-email 2.6.4 In-Reply-To: References: In-Reply-To: References: To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch fixes an unsigned comparison to less than 0. Signed-off-by: Geyslan G. Bem --- Notes: I'm not sure about that comparison because in qh_lines() temp receives the snprintf() return and thereafter occurs this comparison: if (size < temp) temp = size; Is it a test of string truncation right? That possibility is being treated. But if after some snprintf returns the temp is exactly size minus 1 (trailing null)? Could this scenario happen? If yes, I think size could be not counting correctly. Let me know more about it. drivers/usb/host/ehci-dbg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/host/ehci-dbg.c b/drivers/usb/host/ehci-dbg.c index 980ca55..1645120 100644 --- a/drivers/usb/host/ehci-dbg.c +++ b/drivers/usb/host/ehci-dbg.c @@ -542,7 +542,7 @@ static ssize_t fill_async_buffer(struct debug_buffer *buf) next += temp; list_for_each_entry(qh, &ehci->async_unlink, unlink_node) { - if (size <= 0) + if (size == 0) break; qh_lines(ehci, qh, &next, &size); } -- 2.6.4