Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3635390pxb; Mon, 24 Jan 2022 14:04:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJwQgGYNg+TKLF5+vWGex9fC7gLJ+jfBfdQDXbcueCDm3GaS7mEGB0NBGNizmyQ+haU31Pi+ X-Received: by 2002:a63:4f03:: with SMTP id d3mr13233516pgb.311.1643061853958; Mon, 24 Jan 2022 14:04:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061853; cv=none; d=google.com; s=arc-20160816; b=VvlxPV5QZHWGJfYTEm5VCzzLr4+9jwaLQ7mXkx84/jfHsuPjKuB1l7GLq+AxKaWR5k n09Bl8NSKjST4jUtOnHWRqiODGnG/lPjVsuH2mxIpw0Qbj2s1XgWQbsNDmT5LH193Lqd RLumq7VcNW0lSQRYC3RMcbLF4BjiZMFne3nEULry9hjgNeCStAhABQ0vl+x7UZvBbA53 13DdrT5Shfld7ZHYi7xItWvbC50c0OedDo8J/ILewjljTnvCxHk6KNGUuyBhF3O3BPxw 5KWgvEValx1J//nw7FAq5OiRSAObtsI9U7jxMoPrRuL01ZHLWgXrzVvghDH2M4sWvMfP uTGw== 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=xgmV45aY73dAU9xTJ0PBgO/JjMvp5HFazuEXehC9OAJPGQadB2BodO5ogo6khSflxA hpfCYobaXDn/g20megfLiFQyzlAcPuzB5EcQN4NQOyXyaWG2rklb2QMUvvxFmD6jgGQl /anj+9g6ie98YNamZyWii4E93W+WCAYMEeDj8ERQsCCqvDADB2fyDxAqI1NMEAns8pYq dZmE6OnVmFQrJ5HYrcSm65pZ/Kv0ndbtTa5FQBn/uhq9+G1Y/j8mLx05w4CkjEdr5go6 En8GNetVdTZLE1XbZy1MUpKvdAH8CF3ntrNaD8H88b++6WkdREed9rQ7RsHv1FttL82U pfqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=G0GTUC07; 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 f71si14378416pgc.342.2022.01.24.14.03.48; Mon, 24 Jan 2022 14:04:13 -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=G0GTUC07; 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 S1575348AbiAXVva (ORCPT + 99 others); Mon, 24 Jan 2022 16:51:30 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:39510 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1389657AbiAXVQp (ORCPT ); Mon, 24 Jan 2022 16:16:45 -0500 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 B4CBC612E9; Mon, 24 Jan 2022 21:16:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0E13C340E4; Mon, 24 Jan 2022 21:16:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643059000; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G0GTUC07Rmybk5wv02//X2Inmzn27CN5fQvh6j5UiGhXzhJj5BWn78gqXmOq3nUyU sONXiDH//x35cG+CigXPfbY5gtvvp+NxcrlHvq4R6V1MCKCr9bNfMQ1W64Kyc44xBR akJYWKbN9Zn2BDd7RhlVEIoOeRysLMywqYjrvBeI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kees Cook , Sasha Levin Subject: [PATCH 5.16 0470/1039] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:37:39 +0100 Message-Id: <20220124184141.076124919@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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