From patchwork Tue Feb 18 08:56:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiri Kosina X-Patchwork-Id: 3667521 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 9426ABF13A for ; Tue, 18 Feb 2014 08:56:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C37D0201FD for ; Tue, 18 Feb 2014 08:56:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id E2F4F201CD for ; Tue, 18 Feb 2014 08:56:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754057AbaBRI4L (ORCPT ); Tue, 18 Feb 2014 03:56:11 -0500 Received: from cantor2.suse.de ([195.135.220.15]:56303 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754030AbaBRI4K (ORCPT ); Tue, 18 Feb 2014 03:56:10 -0500 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E8A38ABB3; Tue, 18 Feb 2014 08:56:09 +0000 (UTC) Date: Tue, 18 Feb 2014 09:56:07 +0100 (CET) From: Jiri Kosina To: David Barksdale cc: linux-input@vger.kernel.org, fengguang.wu@intel.com Subject: [PATCH] HID: cp2112: fix incorrect error propagation in cp2112_xfer() Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Both cp2112_read_req() and cp2112_write_req() are returning negative value in cases of error, but cp2112_xfer() is storing the return value into unsigned size_t-typed 'count'. Fix this by making 'count' signed type. Reported-by: fengguang.wu@intel.com Signed-off-by: Jiri Kosina --- drivers/hid/hid-cp2112.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c index 6d679f1..1025982 100644 --- a/drivers/hid/hid-cp2112.c +++ b/drivers/hid/hid-cp2112.c @@ -428,7 +428,7 @@ static int cp2112_xfer(struct i2c_adapter *adap, u16 addr, struct hid_device *hdev = dev->hdev; u8 buf[64]; __be16 word; - size_t count; + ssize_t count; size_t read_length = 0; unsigned int retries; int ret;