* [PATCH] peci: Constify struct peci_controller_ops
@ 2023-03-27 22:43 Zev Weiss
2023-03-30 23:39 ` Winiarska, Iwona
0 siblings, 1 reply; 3+ messages in thread
From: Zev Weiss @ 2023-03-27 22:43 UTC (permalink / raw)
To: Iwona Winiarska
Cc: Zev Weiss, Andrew Jeffery, Joel Stanley, linux-arm-kernel,
linux-aspeed, linux-kernel, openbmc
As with most ops structs, we never modify it at runtime, and keeping
function pointers in read-only memory is generally a good thing
security-wise.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
---
drivers/peci/controller/peci-aspeed.c | 2 +-
drivers/peci/core.c | 4 ++--
include/linux/peci.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/peci/controller/peci-aspeed.c b/drivers/peci/controller/peci-aspeed.c
index 731c5d8f75c6..7fdc25afcf2f 100644
--- a/drivers/peci/controller/peci-aspeed.c
+++ b/drivers/peci/controller/peci-aspeed.c
@@ -468,7 +468,7 @@ static void aspeed_peci_property_setup(struct aspeed_peci *priv)
ASPEED_PECI_CMD_TIMEOUT_MS_DEFAULT, &priv->cmd_timeout_ms);
}
-static struct peci_controller_ops aspeed_ops = {
+static const struct peci_controller_ops aspeed_ops = {
.xfer = aspeed_peci_xfer,
};
diff --git a/drivers/peci/core.c b/drivers/peci/core.c
index 9c8cf07e51c7..0f83a9c6093b 100644
--- a/drivers/peci/core.c
+++ b/drivers/peci/core.c
@@ -44,7 +44,7 @@ int peci_controller_scan_devices(struct peci_controller *controller)
}
static struct peci_controller *peci_controller_alloc(struct device *dev,
- struct peci_controller_ops *ops)
+ const struct peci_controller_ops *ops)
{
struct peci_controller *controller;
int ret;
@@ -113,7 +113,7 @@ static void unregister_controller(void *_controller)
* Return: Pointer to the newly allocated controller or ERR_PTR() in case of failure.
*/
struct peci_controller *devm_peci_controller_add(struct device *dev,
- struct peci_controller_ops *ops)
+ const struct peci_controller_ops *ops)
{
struct peci_controller *controller;
int ret;
diff --git a/include/linux/peci.h b/include/linux/peci.h
index 06e6ef935297..9b3d36aff431 100644
--- a/include/linux/peci.h
+++ b/include/linux/peci.h
@@ -42,13 +42,13 @@ struct peci_controller_ops {
*/
struct peci_controller {
struct device dev;
- struct peci_controller_ops *ops;
+ const struct peci_controller_ops *ops;
struct mutex bus_lock; /* held for the duration of xfer */
u8 id;
};
struct peci_controller *devm_peci_controller_add(struct device *parent,
- struct peci_controller_ops *ops);
+ const struct peci_controller_ops *ops);
static inline struct peci_controller *to_peci_controller(void *d)
{
--
2.40.0.5.gf6e3b97ba6d2.dirty
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] peci: Constify struct peci_controller_ops
2023-03-27 22:43 [PATCH] peci: Constify struct peci_controller_ops Zev Weiss
@ 2023-03-30 23:39 ` Winiarska, Iwona
0 siblings, 0 replies; 3+ messages in thread
From: Winiarska, Iwona @ 2023-03-30 23:39 UTC (permalink / raw)
To: zev@bewilderbeest.net
Cc: linux-arm-kernel@lists.infradead.org, andrew@aj.id.au,
linux-kernel@vger.kernel.org, linux-aspeed@lists.ozlabs.org,
joel@jms.id.au, openbmc@lists.ozlabs.org
On Mon, 2023-03-27 at 15:43 -0700, Zev Weiss wrote:
> As with most ops structs, we never modify it at runtime, and keeping
> function pointers in read-only memory is generally a good thing
> security-wise.
>
> Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Thanks
-Iwona
> ---
> drivers/peci/controller/peci-aspeed.c | 2 +-
> drivers/peci/core.c | 4 ++--
> include/linux/peci.h | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] peci: Constify struct peci_controller_ops
@ 2023-06-23 14:28 Iwona Winiarska
0 siblings, 0 replies; 3+ messages in thread
From: Iwona Winiarska @ 2023-06-23 14:28 UTC (permalink / raw)
To: linux-kernel, Greg Kroah-Hartman; +Cc: Zev Weiss, Iwona Winiarska
From: Zev Weiss <zev@bewilderbeest.net>
As with most ops structs, we never modify it at runtime, and keeping
function pointers in read-only memory is generally a good thing
security-wise.
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
Link: https://lore.kernel.org/r/20230327224315.11135-1-zev@bewilderbeest.net
Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>
Signed-off-by: Iwona Winiarska <iwona.winiarska@intel.com>
---
drivers/peci/controller/peci-aspeed.c | 2 +-
drivers/peci/core.c | 4 ++--
include/linux/peci.h | 4 ++--
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/peci/controller/peci-aspeed.c b/drivers/peci/controller/peci-aspeed.c
index 731c5d8f75c6..7fdc25afcf2f 100644
--- a/drivers/peci/controller/peci-aspeed.c
+++ b/drivers/peci/controller/peci-aspeed.c
@@ -468,7 +468,7 @@ static void aspeed_peci_property_setup(struct aspeed_peci *priv)
ASPEED_PECI_CMD_TIMEOUT_MS_DEFAULT, &priv->cmd_timeout_ms);
}
-static struct peci_controller_ops aspeed_ops = {
+static const struct peci_controller_ops aspeed_ops = {
.xfer = aspeed_peci_xfer,
};
diff --git a/drivers/peci/core.c b/drivers/peci/core.c
index 9c8cf07e51c7..0f83a9c6093b 100644
--- a/drivers/peci/core.c
+++ b/drivers/peci/core.c
@@ -44,7 +44,7 @@ int peci_controller_scan_devices(struct peci_controller *controller)
}
static struct peci_controller *peci_controller_alloc(struct device *dev,
- struct peci_controller_ops *ops)
+ const struct peci_controller_ops *ops)
{
struct peci_controller *controller;
int ret;
@@ -113,7 +113,7 @@ static void unregister_controller(void *_controller)
* Return: Pointer to the newly allocated controller or ERR_PTR() in case of failure.
*/
struct peci_controller *devm_peci_controller_add(struct device *dev,
- struct peci_controller_ops *ops)
+ const struct peci_controller_ops *ops)
{
struct peci_controller *controller;
int ret;
diff --git a/include/linux/peci.h b/include/linux/peci.h
index 06e6ef935297..9b3d36aff431 100644
--- a/include/linux/peci.h
+++ b/include/linux/peci.h
@@ -42,13 +42,13 @@ struct peci_controller_ops {
*/
struct peci_controller {
struct device dev;
- struct peci_controller_ops *ops;
+ const struct peci_controller_ops *ops;
struct mutex bus_lock; /* held for the duration of xfer */
u8 id;
};
struct peci_controller *devm_peci_controller_add(struct device *parent,
- struct peci_controller_ops *ops);
+ const struct peci_controller_ops *ops);
static inline struct peci_controller *to_peci_controller(void *d)
{
--
2.40.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-06-23 14:28 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-27 22:43 [PATCH] peci: Constify struct peci_controller_ops Zev Weiss
2023-03-30 23:39 ` Winiarska, Iwona
-- strict thread matches above, loose matches on Subject: below --
2023-06-23 14:28 Iwona Winiarska
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).