Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1884426pxk; Tue, 1 Sep 2020 10:00:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWfRvXQNkGTC/bHzHFipfjOFf2sHRieHC0QAWifWKBSNsuKdeQ9039DYexHRkpS1nXrPXo X-Received: by 2002:a17:906:7143:: with SMTP id z3mr2247741ejj.361.1598979636906; Tue, 01 Sep 2020 10:00:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598979636; cv=none; d=google.com; s=arc-20160816; b=ckNl7AccwDypu2YhM9IPEH3SHqPiU0UmDRVQQV9KVgIevtgjozV9Q4jFG9z4xOeww3 K5cSt/H/QMTwmxvcEPHgG2lDYahhKGvmjBwtec5To2aAU3hn51c0cQNWdgmu/K8QrxC9 A70e8yjQ5jd49xcnjit6dtwI9w+fxmEgJUhe5h8PmBA5RxiNArG+4IE0ONmfsemQ2cEm V634/CmFk6+3IvSk65G+ONlrUMxENQCBEiigxicCnLwLSa961W6RFBvXdomCayaKnVR2 W9JsxNMZk9tdZuT4TaNpS41DFBaJbwOm7leWh75D+X53D/BmQxt5Rn0JA0xyHL5/0ooU e1OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=jLHVAB0m60ah2HTFEBsIS87Ct4H+HPXrsAfi3708JeY=; b=s++9eDpgcXMPc/UKDtocT3IzX8vqFtbJx1WiFamC6hfTm8RltCtwCcTDkT2XfgJz0V uwR/RpbFnmwEUxqv34hZYehYSSW99PfnBoG2Ozl6Hsb6QyuaZ2vZLg5Ik+dyDptSlmpY 00atnP/2bAL+4SFWx+Qvg0htMi+y3uriqB2Mu6rlj0qASAsAAxuenOK30X4F9Mqq+Ln0 oT/qC0CQ0rW3uj+huRFIIuiNqxHT4PxEEadJoHgUn6YQOvZ6Y5BTZ8/n5bf/Id6itbTU 7F21NTBOaLdF4Sxj+FktCNM6FXeS563odxyfNGE+xgTtmEqV1pHI+D8mGKmV9CGQCmRl JoNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Oa7EtPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t14si1007818eje.252.2020.09.01.10.00.12; Tue, 01 Sep 2020 10:00:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=1Oa7EtPc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729976AbgIAQ5e (ORCPT + 99 others); Tue, 1 Sep 2020 12:57:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:46184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729795AbgIAPXR (ORCPT ); Tue, 1 Sep 2020 11:23:17 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id AA79C2100A; Tue, 1 Sep 2020 15:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1598973797; bh=kmamFZ2shPcWg1K0wauWkZZ2BELptm1EAJQ2DNJ4tiI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1Oa7EtPclgELkbmuBtHeO/S0hUyddfKpIhYONlzDlFaXPNa+lToqBlHgNZ6H6kB4l FCa3yLYaYHwV4pgqf/l243RTItM4HcflZnmcn/GhlHtxQDU+85FAJeUu5RaGHTEpuX NWRMpdLKPK5RO1td+sEfGazVi47rLgzRr4uMcknQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Changming Liu , Sasha Levin Subject: [PATCH 4.19 050/125] USB: sisusbvga: Fix a potential UB casued by left shifting a negative value Date: Tue, 1 Sep 2020 17:10:05 +0200 Message-Id: <20200901150937.001525313@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200901150934.576210879@linuxfoundation.org> References: <20200901150934.576210879@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Changming Liu [ Upstream commit 2b53a19284f537168fb506f2f40d7fda40a01162 ] The char buffer buf, receives data directly from user space, so its content might be negative and its elements are left shifted to form an unsigned integer. Since left shifting a negative value is undefined behavior, thus change the char to u8 to elimintate this UB. Signed-off-by: Changming Liu Link: https://lore.kernel.org/r/20200711043018.928-1-charley.ashbringer@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/misc/sisusbvga/sisusb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/misc/sisusbvga/sisusb.c b/drivers/usb/misc/sisusbvga/sisusb.c index 6376be1f5fd22..4877bf82ad395 100644 --- a/drivers/usb/misc/sisusbvga/sisusb.c +++ b/drivers/usb/misc/sisusbvga/sisusb.c @@ -761,7 +761,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr, u8 swap8, fromkern = kernbuffer ? 1 : 0; u16 swap16; u32 swap32, flag = (length >> 28) & 1; - char buf[4]; + u8 buf[4]; /* if neither kernbuffer not userbuffer are given, assume * data in obuf -- 2.25.1