From ab8a3b836133345ce2e29f4a079aaff1f5a33b70 Mon Sep 17 00:00:00 2001 From: Rafal Michalski Date: Wed, 23 Mar 2011 13:11:17 +0100 Subject: [PATCH] Fix strict aliasing issue in hciops This patch changes type of the "pending" variable to uint32_t. A pointer to this variable is passed to the hci_clear_bit function as void * and then cast to uint32_t * again. Previously the unsigned long type could cause some unexpected behavior due to violating strict aliasing rules. This patch fixes this problem by making sure that the same integer type is used in all places. This solution is simpler than the other option of changing the types of all other places (from uint32_t to unsigned long, including changing type for casting in hci_*_bit function family). Also, not all places can be changed, like the hci_dev_info struct, since it would violate compatibility rules between the kernel and user space. --- plugins/hciops.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hciops.c b/plugins/hciops.c index 4225cd8ed..69627eb9a 100644 --- a/plugins/hciops.c +++ b/plugins/hciops.c @@ -111,7 +111,7 @@ static struct dev_info { uint16_t did_version; gboolean up; - unsigned long pending; + uint32_t pending; GIOChannel *io; guint watch_id; -- 2.47.3