Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp659756pxv; Fri, 9 Jul 2021 06:22:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwH39SujRj91SqyZrG7bU8bTBwplr6Megx+9M9XZB2nvJ8UlRi10vrt42lMq21qrEt6xyWO X-Received: by 2002:a6b:7e42:: with SMTP id k2mr16701936ioq.184.1625836953431; Fri, 09 Jul 2021 06:22:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625836953; cv=none; d=google.com; s=arc-20160816; b=cuH4PbdIc90tv0WPCizAyrWeiEkLoJSPoLWbxVlefNJxJXWppW1jL5PvK/3OPzofN9 7hCHjUJG0YGFIrmWZTbyh1NLeOeXxgL1kJsXFIgmHHwTKCHBRw9VsHinXroYU+RaXIpU 2zbUkea56y4IQ58Ykfc7KDeQQxdcUapkCHHlY5PSn8vvJ0ezuFMxSiQE+s/0bv0HcHYJ AmwpmPCgYeXKwL5BIJHt6Gh74mcocbDYCNOa6NIlb70d9XLOw8V9sGixLal1uZYtQb41 AcEUnGWI0o0XZqFUeM0h/++vvvlu+0cn9mjoc1tjaUnKJ0NqBhq0e/1xrNNpKf+M9JyN Qgng== 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=r1sgaxkNbuiwYGBuCi2j/pWNHrdnTV9kKAK1cdbSahw=; b=uQYH4PYfBdShdHTLnC97jstLlsV3eVrIrKbN+FyS1eHzu2VKfeGp1lYHP467hJ2cFl nclt869Byq/8SuSgLtX1QK+31K4o9wzPHmju/xmbxR8qKjhsRfCGV/RgIAVhVnGTDPiM KSq4mucGyCwefTYdTQgTlHL3UXN3yx+bYdby2J7I+cFmZ8LP6ZHXjn2HCI9H8QyO40Gr u0QD/1s84cHJXhkQ8yKIKDGLi3z6hch1UcH4MJ/BBaW8Y69H2HS5/IkKpifwvilz0KAY jw1NovTK82bub44Vo8Lsdj3QpooPcdEC9R8ngYeU3VvPlv8I6MNoVeIqgNccu8ytwhlh dasg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=KAPLuD3U; 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 a1si6457455jat.32.2021.07.09.06.22.20; Fri, 09 Jul 2021 06:22:33 -0700 (PDT) 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=KAPLuD3U; 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 S231872AbhGINWq (ORCPT + 99 others); Fri, 9 Jul 2021 09:22:46 -0400 Received: from mail.kernel.org ([198.145.29.99]:53708 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232355AbhGINWj (ORCPT ); Fri, 9 Jul 2021 09:22:39 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5A056613C0; Fri, 9 Jul 2021 13:19:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1625836794; bh=gs/iwV97RTWQsFLmC09p3GByGLkEda3sj8zGr7drqTQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KAPLuD3Ut909FoDsE7PT9WgydD4dJQLGgwTwTnjKlaOKS19+nvMR17dZUFpAT42BI NTHgte7ja3+mb1zJ3mnB0RB3JTdVz3PjA1cREaJUq5lyVur3uYINk1k3zoYtDaTR3Y lS+jbcDtLPXzFyC1ZzQp8FXTl2B4Ar7l2y2qagto= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Young , Stefani Seibold , Mauro Carvalho Chehab , Matthew Weber Subject: [PATCH 4.14 22/25] kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit Date: Fri, 9 Jul 2021 15:18:53 +0200 Message-Id: <20210709131641.269666523@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210709131627.928131764@linuxfoundation.org> References: <20210709131627.928131764@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: Sean Young commit 8a866fee3909c49738e1c4429a8d2b9bf27e015d upstream. If you try to store u64 in a kfifo (or a struct with u64 members), then the buf member of __STRUCT_KFIFO_PTR will cause 4 bytes padding due to alignment (note that struct __kfifo is 20 bytes on 32 bit). That in turn causes the __is_kfifo_ptr() to fail, which is caught by kfifo_alloc(), which now returns EINVAL. So, ensure that __is_kfifo_ptr() compares to the right structure. Signed-off-by: Sean Young Acked-by: Stefani Seibold Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Matthew Weber Signed-off-by: Greg Kroah-Hartman --- include/linux/kfifo.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/include/linux/kfifo.h +++ b/include/linux/kfifo.h @@ -113,7 +113,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PT * array is a part of the structure and the fifo type where the array is * outside of the fifo structure. */ -#define __is_kfifo_ptr(fifo) (sizeof(*fifo) == sizeof(struct __kfifo)) +#define __is_kfifo_ptr(fifo) \ + (sizeof(*fifo) == sizeof(STRUCT_KFIFO_PTR(typeof(*(fifo)->type)))) /** * DECLARE_KFIFO_PTR - macro to declare a fifo pointer object