From: Lee Jones <lee@kernel.org>
To: lee@kernel.org
Cc: stable@vger.kernel.org,
Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: [PATCH v5.4.y 2/3] rpmsg: Constify local variable in field store macro
Date: Wed, 18 Oct 2023 13:05:18 +0100 [thread overview]
Message-ID: <20231018120527.2110438-3-lee@kernel.org> (raw)
In-Reply-To: <20231018120527.2110438-1-lee@kernel.org>
From: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
commit e5f89131a06142e91073b6959d91cea73861d40e upstream.
Memory pointed by variable 'old' in field store macro is not modified,
so it can be made a pointer to const.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20220419113435.246203-12-krzysztof.kozlowski@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Lee Jones <lee@kernel.org>
---
drivers/rpmsg/rpmsg_core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/rpmsg/rpmsg_core.c b/drivers/rpmsg/rpmsg_core.c
index c1d4990beab02..458ddfc09120b 100644
--- a/drivers/rpmsg/rpmsg_core.c
+++ b/drivers/rpmsg/rpmsg_core.c
@@ -332,7 +332,8 @@ field##_store(struct device *dev, struct device_attribute *attr, \
const char *buf, size_t sz) \
{ \
struct rpmsg_device *rpdev = to_rpmsg_device(dev); \
- char *new, *old; \
+ const char *old; \
+ char *new; \
\
new = kstrndup(buf, sz, GFP_KERNEL); \
if (!new) \
--
2.42.0.655.g421f12c284-goog
next prev parent reply other threads:[~2023-10-18 12:05 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-18 12:05 [PATCH v5.4.y 1/3] driver: platform: Add helper for safer setting of driver_override Lee Jones
2023-10-18 12:05 ` [PATCH v5.4.y 1/2] rpmsg: Constify local variable in field store macro Lee Jones
2023-10-18 12:05 ` Lee Jones [this message]
2023-10-18 12:05 ` [PATCH v5.4.y 2/2] rpmsg: Fix kfree() of static memory on setting driver_override Lee Jones
2023-10-18 12:05 ` [PATCH v5.4.y 3/3] " Lee Jones
2023-10-20 16:07 ` [PATCH v5.4.y 1/3] driver: platform: Add helper for safer setting of driver_override Greg Kroah-Hartman
2023-10-23 9:48 ` Lee Jones
2023-10-23 10:07 ` Greg Kroah-Hartman
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=20231018120527.2110438-3-lee@kernel.org \
--to=lee@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=krzysztof.kozlowski@linaro.org \
--cc=stable@vger.kernel.org \
/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).