Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp4031582pxb; Mon, 21 Feb 2022 10:30:25 -0800 (PST) X-Google-Smtp-Source: ABdhPJzzxqVkDyFYGR9sxJo3whdYcz9Bgk6wqyL4co/DlUBjue7RAgb34EBWgaLp7PN885IEmmKC X-Received: by 2002:a05:6a00:2182:b0:4e1:a254:668 with SMTP id h2-20020a056a00218200b004e1a2540668mr21061473pfi.73.1645468225529; Mon, 21 Feb 2022 10:30:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645468225; cv=none; d=google.com; s=arc-20160816; b=zG8dUcb4gFsR2BYa4fNco8BR4vhKNuRGNt0Fqlb1VQybvXkeaH5iza1/qOy3gbWXsC zHQ/zXiigW2xsiRiWJ6sOAZ75sAQz0kJTY/f3iE+FAiT7IE83diS+e3H0GQ4Ds7XbpZX XCQfXz5u2y2Zs6ZX/R+Pdms+nVYLK7Pj2InFIpX83zulkXtvJgrtUgfTSxinWcUqglDu 0I/vo6MLMJrA8Zjr8QnDuArpmdq0kbzSt1rAv74NV87NoR/86J2PrLpQNlJDoHyqYUo/ kcmjhfO6ZdO1MwD5rP3TekjgaHLS5cvGnAIxUm5o9QXjQKe32M1+/5ewe00hwR8hu6aD f50g== 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=t4kj8cdI/WyXK2tc4Pk0eVdc9su7VN0/RbNT+z0zb9Y=; b=wCrkK0ocCGjtJ05Ilmf3y233gamdppqZw6YHsX96BuZYR4/OiY0JeIMaL56kJVCDNb MjvSuH4EcbDmmyrJ21tss/U4aef8gV2mCM8sGB/DeHGMHie6dKVHQIaMeo1QRa3anb5T 2FTJ77Qso0D6/37khlu/N7qvZthWEIgq3h936BsGasWdo7Eg6/pS47PUNxRmGzTXLju1 bWcErsICEpCydkl1RbT0Xzbc/dO4UBk8SGfv7yQPDS7LyMbpd/scHkegDnPFpAjDUBng LzG9aX4gZmtkmashaYAnYjlxsNyOsYlhEuff83MxxNEkjg8g2sjCVkQUNjyxTg1JQu2a CPYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UyS7M+OK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f12si31703853plg.294.2022.02.21.10.30.10; Mon, 21 Feb 2022 10:30:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=UyS7M+OK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S1354177AbiBUKDG (ORCPT + 99 others); Mon, 21 Feb 2022 05:03:06 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:50552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352460AbiBUJzQ (ORCPT ); Mon, 21 Feb 2022 04:55:16 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C77A38BFC; Mon, 21 Feb 2022 01:24:23 -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 ams.source.kernel.org (Postfix) with ESMTPS id D30F6B80EBB; Mon, 21 Feb 2022 09:24:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F2414C340E9; Mon, 21 Feb 2022 09:24:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1645435460; bh=DL49cb9d1UNYv3vnuLE5vghj+o41h5Rq2job1VvuVjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UyS7M+OKBfcM8d4gOliEUXbYyQQRdS+x79AHQXfqLO+/Qoerul1vtQV2ienTlYRXQ CqMcyYFkENv5oYitzO3z/w95mzsQsWr2yC8Zol6g7C9Fb1MXORck3F/OL/G1cWAbjn LrsLcZTGXvHBE7o9x5J0wAWXIlpw/9S7S6cETfnk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eliav Farber , Borislav Petkov Subject: [PATCH 5.16 171/227] EDAC: Fix calculation of returned address and next offset in edac_align_ptr() Date: Mon, 21 Feb 2022 09:49:50 +0100 Message-Id: <20220221084940.499270787@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220221084934.836145070@linuxfoundation.org> References: <20220221084934.836145070@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eliav Farber commit f8efca92ae509c25e0a4bd5d0a86decea4f0c41e upstream. Do alignment logic properly and use the "ptr" local variable for calculating the remainder of the alignment. This became an issue because struct edac_mc_layer has a size that is not zero modulo eight, and the next offset that was prepared for the private data was unaligned, causing an alignment exception. The patch in Fixes: which broke this actually wanted to "what we actually care about is the alignment of the actual pointer that's about to be returned." But it didn't check that alignment. Use the correct variable "ptr" for that. [ bp: Massage commit message. ] Fixes: 8447c4d15e35 ("edac: Do alignment logic properly in edac_align_ptr()") Signed-off-by: Eliav Farber Signed-off-by: Borislav Petkov Cc: Link: https://lore.kernel.org/r/20220113100622.12783-2-farbere@amazon.com Signed-off-by: Greg Kroah-Hartman --- drivers/edac/edac_mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/edac/edac_mc.c +++ b/drivers/edac/edac_mc.c @@ -213,7 +213,7 @@ void *edac_align_ptr(void **p, unsigned else return (char *)ptr; - r = (unsigned long)p % align; + r = (unsigned long)ptr % align; if (r == 0) return (char *)ptr;