Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3580088pxb; Mon, 24 Jan 2022 12:43:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJxuUxq5oN4yJ5B2R/YqB/DHIkXGAQS2I0QK/8M9r1Udj10lRacJ8HUzlCsOCcd6Ctm9cu1k X-Received: by 2002:a05:6a00:1798:b0:4c8:df86:9e15 with SMTP id s24-20020a056a00179800b004c8df869e15mr7604390pfg.72.1643056980815; Mon, 24 Jan 2022 12:43:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643056980; cv=none; d=google.com; s=arc-20160816; b=iY0lsQqKE49FVyoCiTW805aPgl4IzBtSVBWuOBSIgt9WyBSHh31V1+FsVVP1uzs5IK FPIwyw+4y5RD8eZNpjx7RiRqfVygksXIPk2X0ALEDmdu4mx+MpfEudUK1e3Zdlzg01PB 2W7KuwCgH5updpUoqTWRPRnMTJa+6P9+bh9V2THWnPMrzOUdmrqukEJ9i3NJ84e4grCc w5m4Dvyii/B6zeGXhBO7rsFlEDmDsH9ZuPJFV+ISUIHA8EopFth3sK9XY4HPbuUbxQut eAMrcdptMeasi0Q2p6sOW224neACp/zfxcBF252INcUKtrQXzXPvfh+YkzbwmWxPn+Cv Gfow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yjt+W7J8xAUW8hlfS4hIvIa1EuLD83VOglt0ZbbwvgA=; b=Fae09j2+QuBAYlsnVQVdsQrmwGaqMyso7/FOIjyvCAaWRMcNWTfxIS7sxFhGezZeN5 lrIVuU+3WEUVkmGLWBpZicUWp2GD9O04b12JD8iLnBZjJ2wIAppXxSPizRst8bEwev4B eu4ju+jhS9zlHM+/1zeQP4zM43hmScjdgjBhBrRuRgBI0iCAuDJYCiN6kG9rtMZA/ix8 aGgbvOLiH71cPYSNwrLwiOJntX7aulJ+nVyXLOGSBQ/6kMZo5ua1U2bfAWj4nl/3Bvtz TSkXZ1hDVjmPU/p9QeYbeKzsnwS8IY5RHT70uIPLIhcNkJtY5DkATYVVBbJl70Nrd+Lr ee/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=mTNoHkbi; 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=pass (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 r20si12890520pgu.89.2022.01.24.12.42.33; Mon, 24 Jan 2022 12:43:00 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=mTNoHkbi; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1359608AbiAXT7y (ORCPT + 99 others); Mon, 24 Jan 2022 14:59:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54230 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348920AbiAXTk7 (ORCPT ); Mon, 24 Jan 2022 14:40:59 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFA34C0613E7; Mon, 24 Jan 2022 11:19:40 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4EED761317; Mon, 24 Jan 2022 19:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2ED46C340E8; Mon, 24 Jan 2022 19:19:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643051979; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mTNoHkbi2G/vIR0yU+zQDWXHU8RLjoSS60GeyVzCoww+t201svbfVvO+Kv2H92rX5 Oy6I/a4CIKxZvbN5FhPH92ndO6j7CZCJhOvteOSpC6gF4AcBHlTQtxUf7wEISGZyJ8 W3i1WH8v1+lijfeUkiSZw26ii8IXWzkscvFEecTs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Sasha Levin Subject: [PATCH 4.19 106/239] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:42:24 +0100 Message-Id: <20220124183946.477016172@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183943.102762895@linuxfoundation.org> References: <20220124183943.102762895@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Kees Cook [ Upstream commit f5912cc19acd7c24b2dbf65a6340bf194244f085 ] Using MKWORD() on a byte-sized variable results in OOB read. Expand the size of the reserved area so both MKWORD and MKBYTE continue to work without overflow. Silences this warning on a -Warray-bounds build: drivers/char/mwave/3780i.h:346:22: error: array subscript 'short unsigned int[0]' is partly outside array bounds of 'DSP_ISA_SLAVE_CONTROL[1]' [-Werror=array-bounds] 346 | #define MKWORD(var) (*((unsigned short *)(&var))) | ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/char/mwave/3780i.h:356:40: note: in definition of macro 'OutWordDsp' 356 | #define OutWordDsp(index,value) outw(value,usDspBaseIO+index) | ^~~~~ drivers/char/mwave/3780i.c:373:41: note: in expansion of macro 'MKWORD' 373 | OutWordDsp(DSP_IsaSlaveControl, MKWORD(rSlaveControl)); | ^~~~~~ drivers/char/mwave/3780i.c:358:31: note: while referencing 'rSlaveControl' 358 | DSP_ISA_SLAVE_CONTROL rSlaveControl; | ^~~~~~~~~~~~~ Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Kees Cook Link: https://lore.kernel.org/r/20211203084206.3104326-1-keescook@chromium.org Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/char/mwave/3780i.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/char/mwave/3780i.h b/drivers/char/mwave/3780i.h index 9ccb6b270b071..95164246afd1a 100644 --- a/drivers/char/mwave/3780i.h +++ b/drivers/char/mwave/3780i.h @@ -68,7 +68,7 @@ typedef struct { unsigned char ClockControl:1; /* RW: Clock control: 0=normal, 1=stop 3780i clocks */ unsigned char SoftReset:1; /* RW: Soft reset 0=normal, 1=soft reset active */ unsigned char ConfigMode:1; /* RW: Configuration mode, 0=normal, 1=config mode */ - unsigned char Reserved:5; /* 0: Reserved */ + unsigned short Reserved:13; /* 0: Reserved */ } DSP_ISA_SLAVE_CONTROL; -- 2.34.1