* [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
@ 2024-04-12 10:21 Heiner Kallweit
2024-04-12 10:30 ` Wolfram Sang
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Heiner Kallweit @ 2024-04-12 10:21 UTC (permalink / raw)
To: Jean Delvare, Andi Shyti; +Cc: linux-i2c@vger.kernel.org
Annotate this variable as __ro_after_init to protect it from being
overwritten later.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
drivers/i2c/busses/i2c-i801.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 6d027a77d..e577abc77 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1060,7 +1060,7 @@ static const struct pci_device_id i801_ids[] = {
MODULE_DEVICE_TABLE(pci, i801_ids);
#if defined CONFIG_X86 && defined CONFIG_DMI
-static unsigned char apanel_addr;
+static unsigned char apanel_addr __ro_after_init;
/* Scan the system ROM for the signature "FJKEYINF" */
static __init const void __iomem *bios_signature(const void __iomem *bios)
--
2.44.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-12 10:21 [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init Heiner Kallweit
@ 2024-04-12 10:30 ` Wolfram Sang
2024-04-12 10:48 ` Heiner Kallweit
2024-04-15 21:05 ` Andi Shyti
2024-04-16 22:46 ` Andi Shyti
2 siblings, 1 reply; 7+ messages in thread
From: Wolfram Sang @ 2024-04-12 10:30 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Jean Delvare, Andi Shyti, linux-i2c@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 160 bytes --]
> #if defined CONFIG_X86 && defined CONFIG_DMI
Shouldn't that be on top of "[PATCH v2] i2c: i801: Fix missing Kconfig
dependency" which Andi already merged?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-12 10:30 ` Wolfram Sang
@ 2024-04-12 10:48 ` Heiner Kallweit
2024-04-12 10:57 ` Wolfram Sang
0 siblings, 1 reply; 7+ messages in thread
From: Heiner Kallweit @ 2024-04-12 10:48 UTC (permalink / raw)
To: Wolfram Sang, Jean Delvare, Andi Shyti, linux-i2c@vger.kernel.org
On 12.04.2024 12:30, Wolfram Sang wrote:
>> #if defined CONFIG_X86 && defined CONFIG_DMI
>
> Shouldn't that be on top of "[PATCH v2] i2c: i801: Fix missing Kconfig
> dependency" which Andi already merged?
>
No, this is a different code part here. The other one was
protected with:
#if IS_ENABLED(CONFIG_I2C_MUX_GPIO) && defined CONFIG_DMI
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-12 10:48 ` Heiner Kallweit
@ 2024-04-12 10:57 ` Wolfram Sang
0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2024-04-12 10:57 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Jean Delvare, Andi Shyti, linux-i2c@vger.kernel.org
[-- Attachment #1: Type: text/plain, Size: 88 bytes --]
> No, this is a different code part here. The other one was
Oh. Sorry for the noise!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-12 10:21 [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init Heiner Kallweit
2024-04-12 10:30 ` Wolfram Sang
@ 2024-04-15 21:05 ` Andi Shyti
2024-04-15 21:20 ` Heiner Kallweit
2024-04-16 22:46 ` Andi Shyti
2 siblings, 1 reply; 7+ messages in thread
From: Andi Shyti @ 2024-04-15 21:05 UTC (permalink / raw)
To: Heiner Kallweit; +Cc: Jean Delvare, linux-i2c@vger.kernel.org
Hi Heiner,
On Fri, Apr 12, 2024 at 12:21:58PM +0200, Heiner Kallweit wrote:
> Annotate this variable as __ro_after_init to protect it from being
> overwritten later.
What is the reason behind this patch? Where is the risk of
overwriting this variable?
Andi
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-15 21:05 ` Andi Shyti
@ 2024-04-15 21:20 ` Heiner Kallweit
0 siblings, 0 replies; 7+ messages in thread
From: Heiner Kallweit @ 2024-04-15 21:20 UTC (permalink / raw)
To: Andi Shyti; +Cc: Jean Delvare, linux-i2c@vger.kernel.org
On 15.04.2024 23:05, Andi Shyti wrote:
> Hi Heiner,
>
> On Fri, Apr 12, 2024 at 12:21:58PM +0200, Heiner Kallweit wrote:
>> Annotate this variable as __ro_after_init to protect it from being
>> overwritten later.
>
> What is the reason behind this patch? Where is the risk of
> overwriting this variable?
>
The annotation makes clear that this variable is to be written
by init code only, w/o having to check all usage in the driver.
Currently the variable isn't written later, however the annotation
protects from any such potential attempt in the future.
The original commit message has more arguments for using this
annotation. https://lwn.net/Articles/676145/
> Andi
Heiner
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init
2024-04-12 10:21 [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init Heiner Kallweit
2024-04-12 10:30 ` Wolfram Sang
2024-04-15 21:05 ` Andi Shyti
@ 2024-04-16 22:46 ` Andi Shyti
2 siblings, 0 replies; 7+ messages in thread
From: Andi Shyti @ 2024-04-16 22:46 UTC (permalink / raw)
To: Jean Delvare, Heiner Kallweit; +Cc: linux-i2c
Hi
On Fri, 12 Apr 2024 12:21:58 +0200, Heiner Kallweit wrote:
> Annotate this variable as __ro_after_init to protect it from being
> overwritten later.
>
>
Applied to i2c/i2c-host on
git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
Thank you,
Andi
Patches applied
===============
[1/1] i2c: i801: Annotate apanel_addr as __ro_after_init
commit: 08944c074592041873f1cb3e5be5fc3fd4cdc3ad
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-16 22:46 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-12 10:21 [PATCH] i2c: i801: Annotate apanel_addr as __ro_after_init Heiner Kallweit
2024-04-12 10:30 ` Wolfram Sang
2024-04-12 10:48 ` Heiner Kallweit
2024-04-12 10:57 ` Wolfram Sang
2024-04-15 21:05 ` Andi Shyti
2024-04-15 21:20 ` Heiner Kallweit
2024-04-16 22:46 ` Andi Shyti
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox