diff options
| author | Linus Walleij <linusw@kernel.org> | 2026-05-18 01:01:19 +0200 |
|---|---|---|
| committer | Linus Walleij <linusw@kernel.org> | 2026-05-25 10:13:43 +0200 |
| commit | 50bb01954a457b573c0c574eb89249c776555568 (patch) | |
| tree | aaa774594cc15484389a761dba41d8528bf10063 /drivers/pinctrl/starfive | |
| parent | 4af4eb66aac382b08a8fcf822161f48cbed3aa08 (diff) | |
| download | linux-next-50bb01954a457b573c0c574eb89249c776555568.tar.gz linux-next-50bb01954a457b573c0c574eb89249c776555568.zip | |
pinctrl: starfive: jh7110: Use __counted_by() flexarray
Flexible arrays should use __counted_by() to be able to do
runtime checks that the array does not go out of range.
Cc: Rosen Penev <rosenp@gmail.com>
Fixes: 87182ef0bf93 ("pinctrl: starfive: jh7110: use struct_size")
Signed-off-by: Linus Walleij <linusw@kernel.org>
Diffstat (limited to 'drivers/pinctrl/starfive')
| -rw-r--r-- | drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c | 1 | ||||
| -rw-r--r-- | drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h | 3 |
2 files changed, 3 insertions, 1 deletions
diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c index 3572e8edd9f3..3fb9aa8ddf07 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.c @@ -865,6 +865,7 @@ int jh7110_pinctrl_probe(struct platform_device *pdev) #endif if (!sfp) return -ENOMEM; + sfp->num_saved_regs = info->nsaved_regs; sfp->base = devm_platform_ioremap_resource(pdev, 0); if (IS_ERR(sfp->base)) diff --git a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h index 188fc9d96269..12568be28527 100644 --- a/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h +++ b/drivers/pinctrl/starfive/pinctrl-starfive-jh7110.h @@ -21,7 +21,8 @@ struct jh7110_pinctrl { /* register read/write mutex */ struct mutex mutex; const struct jh7110_pinctrl_soc_info *info; - u32 saved_regs[]; + unsigned int num_saved_regs; + u32 saved_regs[] __counted_by(num_saved_regs); }; struct jh7110_gpio_irq_reg { |
