Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3603225pxb; Mon, 24 Jan 2022 13:17:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJxT2CSM5YRjK2n/dimLlaXcM8/pdAL8KO8JjArf96LHk8MekGeD4RdykwG+NOIAXhWsyNU9 X-Received: by 2002:a05:6a00:2182:b0:4a7:ec46:29da with SMTP id h2-20020a056a00218200b004a7ec4629damr15329033pfi.68.1643059039127; Mon, 24 Jan 2022 13:17:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643059039; cv=none; d=google.com; s=arc-20160816; b=nVOF5hOE8rE9EMcL3GgMx2aSHFFRrSR35pPpAcm3sx0rYWEJYax1Mf4yZD/TyAu8M3 kpV30N8itNiVArOHQQjohJKK2tWlpFCxOyAKth8CsdS22ZN58C4riz1GE4lbN82+f5Ei uPgIEuSJkrmUBsxT5spfIHCPTN0aLPlYMTBuOqqlspXQN/Y7DOeIGahEH0Wx/JqeJ7hC wmLVvq7uNuhaX0X5RQRFJ994kSwwVRCrsV+tQ711RQfpP/zORKX0Sd24+fYnfmmDSdqX AHJmbAZONAZ/Qa65D7HsyV5nfsSQ+y0kY/BtRE0Fx3j50EFdJbjuZrsVKGpVKjSA2WRo 2qkw== 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=JvVD2cJxpawNpStz7xClwe9ReAqcUtgYVU+qOJjXs/14M5rBbV0rVfi6mgdQw0szZM CzQX23j2EWPhJBs9aBcxcnr2cAycV35VLdFwtO5XdRjhc0X0Os7/RCGhPWn7Oed6wgdM LgAxKMzOdly0cKecJnfldUEsZL1ix+SORhqQR9GM5zRUHsbAjz7BxB/bEsnV7jOQ85pr N83Qu8nIwPtJSvyGa/0IKZrJONSQpBsD/FZwGQ4JM8X972vsl58+8TLGhj3LmMoqk233 9/VvHw1D8yg0z6PY58H8ROfuAFY2TjRB26ELcItaS1CK+gL01Tpb2EjgG6F5an89hd94 2C1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gLC5f3Ko; 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 j3si16393744pfc.28.2022.01.24.13.17.06; Mon, 24 Jan 2022 13:17:19 -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=gLC5f3Ko; 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 S1442058AbiAXUwl (ORCPT + 99 others); Mon, 24 Jan 2022 15:52:41 -0500 Received: from ams.source.kernel.org ([145.40.68.75]:35962 "EHLO ams.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384555AbiAXUaE (ORCPT ); Mon, 24 Jan 2022 15:30:04 -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 ams.source.kernel.org (Postfix) with ESMTPS id 45351B8121A; Mon, 24 Jan 2022 20:30:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 74BBBC340E5; Mon, 24 Jan 2022 20:29:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643056200; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gLC5f3Koh5ayJC2USpP6jgtjipH/3smluYrcUSBZX8++BXnmjvZiEUoKWNI0J5d8F k7+g78oCxunBXwIXXjaApyf1D2DTjltW31NRsR4lazEjMBBPdcZICsClhS0IiSmQm0 9nn2yvJob1rCQxbJMrVAA9/Fc9vYykNSq+hyEqFs= 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.15 397/846] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:38:34 +0100 Message-Id: <20220124184114.649441386@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184100.867127425@linuxfoundation.org> References: <20220124184100.867127425@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