From: Yuan Can <yuancan@huawei.com>
To: <ysato@users.sourceforge.jp>, <dalias@libc.org>,
<lethal@linux-sh.org>, <linux-sh@vger.kernel.org>
Cc: <yuancan@huawei.com>
Subject: [PATCH 1/2] sh: intc: Fix compile errors about casting
Date: Fri, 18 Nov 2022 02:46:10 +0000 [thread overview]
Message-ID: <20221118024611.112732-2-yuancan@huawei.com> (raw)
In-Reply-To: <20221118024611.112732-1-yuancan@huawei.com>
The following errors was given when compiling drivers/sh/intc/core.c
drivers/sh/intc/core.c: In function ‘intc_redirect_irq’:
drivers/sh/intc/core.c:70:21: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
^
drivers/sh/intc/core.c: In function ‘intc_register_irq’:
drivers/sh/intc/core.c:119:25: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
irq_set_chip_data(irq, (void *)data[primary]);
^
drivers/sh/intc/core.c: In function ‘register_intc_controller’:
drivers/sh/intc/core.c:360:9: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(void *)irq);
^
cc1: all warnings being treated as errors
Fix by casting variables to unsigned long first.
Fixes: 2be6bb0c79c7 ("sh: intc: Split up the INTC code.")
Signed-off-by: Yuan Can <yuancan@huawei.com>
---
drivers/sh/intc/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/sh/intc/core.c b/drivers/sh/intc/core.c
index ca4f4ca413f1..4a4ad10de758 100644
--- a/drivers/sh/intc/core.c
+++ b/drivers/sh/intc/core.c
@@ -67,7 +67,7 @@ void intc_set_prio_level(unsigned int irq, unsigned int level)
static void intc_redirect_irq(struct irq_desc *desc)
{
- generic_handle_irq((unsigned int)irq_desc_get_handler_data(desc));
+ generic_handle_irq((unsigned long)irq_desc_get_handler_data(desc));
}
static void __init intc_register_irq(struct intc_desc *desc,
@@ -116,7 +116,7 @@ static void __init intc_register_irq(struct intc_desc *desc,
disable_irq_nosync(irq);
irq_set_chip_and_handler_name(irq, &d->chip, handle_level_irq,
"level");
- irq_set_chip_data(irq, (void *)data[primary]);
+ irq_set_chip_data(irq, (void *)(unsigned long)data[primary]);
/*
* set priority level
@@ -357,7 +357,7 @@ int __init register_intc_controller(struct intc_desc *desc)
irq_set_chip(irq2, &dummy_irq_chip);
irq_set_chained_handler_and_data(irq2,
intc_redirect_irq,
- (void *)irq);
+ (void *)(unsigned long)irq);
}
}
--
2.17.1
next prev parent reply other threads:[~2022-11-18 2:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-18 2:46 [PATCH 0/2] sh: intc: Fix UAF and compile error problems Yuan Can
2022-11-18 2:46 ` Yuan Can [this message]
2022-11-18 2:46 ` [PATCH 2/2] sh: intc: Fix possible UAF in register_intc_controller() Yuan Can
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=20221118024611.112732-2-yuancan@huawei.com \
--to=yuancan@huawei.com \
--cc=dalias@libc.org \
--cc=lethal@linux-sh.org \
--cc=linux-sh@vger.kernel.org \
--cc=ysato@users.sourceforge.jp \
/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).