From: Sean Young <sean@mess.org>
To: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
Stefani Seibold <stefani@seibold.net>,
Randy Dunlap <randy.dunlap@oracle.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH v3 26/26] kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit
Date: Tue, 10 Oct 2017 08:18:56 +0100 [thread overview]
Message-ID: <cecafa286ae244af48e6e131b7ac52ded0c3da99.1507618841.git.sean@mess.org> (raw)
In-Reply-To: <cover.1507618840.git.sean@mess.org>
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 <sean@mess.org>
---
include/linux/kfifo.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/include/linux/kfifo.h b/include/linux/kfifo.h
index 41eb6fdf87a8..86b5fb08e96c 100644
--- a/include/linux/kfifo.h
+++ b/include/linux/kfifo.h
@@ -113,7 +113,8 @@ struct kfifo_rec_ptr_2 __STRUCT_KFIFO_PTR(unsigned char, 2, void);
* 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
--
2.13.6
next prev parent reply other threads:[~2017-10-10 7:18 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-10 7:17 [PATCH v3 00/26] lirc scancode interface, and more Sean Young
2017-10-10 7:17 ` [PATCH v3 01/26] media: lirc: implement scancode sending Sean Young
2017-10-10 7:17 ` [PATCH v3 02/26] media: lirc: use the correct carrier for scancode transmit Sean Young
2017-10-10 7:17 ` [PATCH v3 03/26] media: rc: auto load encoder if necessary Sean Young
2017-10-10 7:17 ` [PATCH v3 04/26] media: lirc_zilog: remove receiver Sean Young
2017-10-11 19:43 ` Andy Walls
2017-10-11 21:02 ` Sean Young
2017-10-11 23:24 ` Andy Walls
2017-10-12 0:25 ` Devin Heitmueller
2017-10-12 0:50 ` Andy Walls
2017-10-12 2:25 ` Devin Heitmueller
2017-10-12 12:25 ` Sean Young
2017-10-12 11:40 ` Sean Young
2017-10-10 7:17 ` [PATCH v3 05/26] media: lirc_zilog: fix variable types and other ugliness Sean Young
2017-10-10 7:17 ` [PATCH v3 06/26] media: lirc_zilog: port to rc-core using scancode tx interface Sean Young
2017-10-10 7:17 ` [PATCH v3 07/26] media: promote lirc_zilog out of staging Sean Young
2017-10-10 7:17 ` [PATCH v3 08/26] media: lirc: remove LIRCCODE and LIRC_GET_LENGTH Sean Young
2017-10-10 7:17 ` [PATCH v3 09/26] media: lirc: lirc interface should not be a raw decoder Sean Young
2017-10-10 7:17 ` [PATCH v3 10/26] media: lirc: validate scancode for transmit Sean Young
2017-10-10 7:18 ` [PATCH v3 11/26] media: rc: document and fix rc_validate_scancode() Sean Young
2017-10-10 7:18 ` [PATCH v3 12/26] media: lirc: merge lirc_dev_fop_ioctl and ir_lirc_ioctl Sean Young
2017-10-10 7:18 ` [PATCH v3 13/26] media: lirc: use kfifo rather than lirc_buffer for raw IR Sean Young
2017-10-10 7:18 ` [PATCH v3 14/26] media: lirc: move lirc_dev->attached to rc_dev->registered Sean Young
2017-10-10 7:18 ` [PATCH v3 15/26] media: lirc: do not call rc_close() on unregistered devices Sean Young
2017-10-10 7:18 ` [PATCH v3 16/26] media: lirc: create rc-core open and close lirc functions Sean Young
2017-10-10 7:18 ` [PATCH v3 17/26] media: lirc: remove name from lirc_dev Sean Young
2017-10-10 7:18 ` [PATCH v3 18/26] media: lirc: remove last remnants of lirc kapi Sean Young
2017-10-10 7:18 ` [PATCH v3 19/26] media: lirc: implement reading scancode Sean Young
2017-10-10 7:18 ` [PATCH v3 20/26] media: rc: ensure lirc device receives nec repeats Sean Young
2017-10-10 7:18 ` [PATCH v3 21/26] media: lirc: document LIRC_MODE_SCANCODE Sean Young
2017-10-10 7:18 ` [PATCH v3 22/26] media: lirc: introduce LIRC_SET_POLL_MODES Sean Young
2017-10-10 7:18 ` [PATCH v3 23/26] media: lirc: scancode rc devices should have a lirc device too Sean Young
2017-10-10 7:18 ` [PATCH v3 24/26] media: MAINTAINERS: remove lirc staging area Sean Young
2017-10-10 7:18 ` [PATCH v3 25/26] media: MAINTAINERS: add entry for zilog_ir Sean Young
2017-10-10 7:18 ` Sean Young [this message]
2017-10-10 7:59 ` [PATCH v3 26/26] kfifo: DECLARE_KIFO_PTR(fifo, u64) does not work on arm 32 bit Sean Young
2017-11-30 12:29 ` Mauro Carvalho Chehab
2017-11-30 12:34 ` Stefani Seibold
2017-12-08 14:07 ` Mauro Carvalho Chehab
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cecafa286ae244af48e6e131b7ac52ded0c3da99.1507618841.git.sean@mess.org \
--to=sean@mess.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=randy.dunlap@oracle.com \
--cc=stefani@seibold.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).