Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3555362pxb; Mon, 24 Jan 2022 12:07:20 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4QEwhV4r2aMOyoYnOMhuXlGdrGU+ES2faooIG2reVtUcpHog0UN0onesNTFwh1bmCL7+6 X-Received: by 2002:a63:5753:: with SMTP id h19mr12864197pgm.402.1643054839966; Mon, 24 Jan 2022 12:07:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643054839; cv=none; d=google.com; s=arc-20160816; b=kBsSMrbKYOBWvm2AJDzGZREDQ79uiqyTm2qZiJ0UiffYvNKyeD+GF2N6WkO9x7pa8d SnGXfApRRVpWg0TyyHy69xMCfPZ2OH3cqcRu6RceV6K1+UjxsZS7z80fEMyzBjuBG2yX E0gApke9EudGYeP69cCTcaN9bNzIV5RQfTusIQNn3h5FQGPXwOcZBGC6YDBDQVEnRitH pTYvdrFPcCKnj6gWYIQzuTv7F9olXZ5lxYs575P209fr/lDUjT2KvLpqCYk5qSXST/KX UFD2lKnnbZ2+EPWwThQep1zia8vFP2SKozPsiisbeaj1s+odnOCruTnPAZVqsPPyi6Px fvDA== 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=tV7BI1lte+oNRessOExWai8NYI0wrZXC1Nu6K7Esz1MOtReiLMnmPLRDq2Z4S0lNyx lhXkk66PO8S42Y6vrWEg3chs2QyUlqqqKbXKICSs5V+4sNZ/EeIcm35SpiD5n7n3DHah CjE2RyiVGlZa9E58qOF668cP+fWVO72ggxqGqq7hBtedrF2jvF9LqjtRbza8jE6y7XjX PKVwfg208U99xnK8fu8Bgt5xrPmK3Myl4fihVl7e2mHjQUMOs1sQCgIijFLI7K4ZXFvI nzmPPpXP7uyGeO4KiCFV945weyJF7dxrNv4dp/Lhw2HvAsKl7k94vbm5hjPlPQc9kRzB PTYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=aHyujCZA; 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 e70si14695951pgc.66.2022.01.24.12.07.06; Mon, 24 Jan 2022 12:07: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=aHyujCZA; 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 S1346329AbiAXTFW (ORCPT + 99 others); Mon, 24 Jan 2022 14:05:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345343AbiAXTAI (ORCPT ); Mon, 24 Jan 2022 14:00:08 -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 7F51DC061793; Mon, 24 Jan 2022 10:57:12 -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 1FAF76154A; Mon, 24 Jan 2022 18:57:12 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7E2FC340E5; Mon, 24 Jan 2022 18:57:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643050631; bh=0KD1eiKFQZ+15lvlwGjcpA2CZ9608oocxiXbhgHw+rM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aHyujCZAr2Z2Fm9pqKveNg4112DjtAV/WiSCnEl78T1iWeKOUu4akxiCwKqxJeLkV B2XOR+/5sRJ2tN03MHnw50uhi/HUDazg0MERtQ9CRl+dLoPMYnCTZiMajgisFVzCHj 6srHYjqe1Cx4hkrDxfwbdAZuZQ+KaDkm4eZpx+qE= 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.9 063/157] char/mwave: Adjust io port register size Date: Mon, 24 Jan 2022 19:42:33 +0100 Message-Id: <20220124183934.788737719@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183932.787526760@linuxfoundation.org> References: <20220124183932.787526760@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