* [PATCH -next] staging/speakup: Switch to kmemdup_nul()
@ 2021-04-02 9:21 Yang Yingliang
2021-04-02 13:13 ` Greg KH
0 siblings, 1 reply; 3+ messages in thread
From: Yang Yingliang @ 2021-04-02 9:21 UTC (permalink / raw)
To: linux-kernel, speakup; +Cc: gregkh
Use kmemdup_nul() helper instead of open-coding to
simplify the code.
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
drivers/accessibility/speakup/i18n.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/accessibility/speakup/i18n.c b/drivers/accessibility/speakup/i18n.c
index ee240d36f947..46bd50f3c3a4 100644
--- a/drivers/accessibility/speakup/i18n.c
+++ b/drivers/accessibility/speakup/i18n.c
@@ -548,12 +548,10 @@ ssize_t spk_msg_set(enum msg_index_t index, char *text, size_t length)
if ((index < MSG_FIRST_INDEX) || (index >= MSG_LAST_INDEX))
return -EINVAL;
- newstr = kmalloc(length + 1, GFP_KERNEL);
+ newstr = kmemdup_nul(text, length, GFP_KERNEL);
if (!newstr)
return -ENOMEM;
- memcpy(newstr, text, length);
- newstr[length] = '\0';
if (index >= MSG_FORMATTED_START &&
index <= MSG_FORMATTED_END &&
!fmt_validate(speakup_default_msgs[index], newstr)) {
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH -next] staging/speakup: Switch to kmemdup_nul()
2021-04-02 9:21 [PATCH -next] staging/speakup: Switch to kmemdup_nul() Yang Yingliang
@ 2021-04-02 13:13 ` Greg KH
2021-04-06 1:53 ` Yang Yingliang
0 siblings, 1 reply; 3+ messages in thread
From: Greg KH @ 2021-04-02 13:13 UTC (permalink / raw)
To: Yang Yingliang; +Cc: linux-kernel, speakup
On Fri, Apr 02, 2021 at 05:21:11PM +0800, Yang Yingliang wrote:
> Use kmemdup_nul() helper instead of open-coding to
> simplify the code.
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
> ---
> drivers/accessibility/speakup/i18n.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
Your subject line is very odd, why does it have "staging"?
Your robot is not doing well these days...
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH -next] staging/speakup: Switch to kmemdup_nul()
2021-04-02 13:13 ` Greg KH
@ 2021-04-06 1:53 ` Yang Yingliang
0 siblings, 0 replies; 3+ messages in thread
From: Yang Yingliang @ 2021-04-06 1:53 UTC (permalink / raw)
To: Greg KH; +Cc: linux-kernel, speakup
Hi,
On 2021/4/2 21:13, Greg KH wrote:
> On Fri, Apr 02, 2021 at 05:21:11PM +0800, Yang Yingliang wrote:
>> Use kmemdup_nul() helper instead of open-coding to
>> simplify the code.
>>
>> Reported-by: Hulk Robot <hulkci@huawei.com>
>> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
>> ---
>> drivers/accessibility/speakup/i18n.c | 4 +---
>> 1 file changed, 1 insertion(+), 3 deletions(-)
> Your subject line is very odd, why does it have "staging"?
I check git log of this file and use prefix of the history title,
obviously I was wrong,
I will send a v2 later.
Thanks,
Yang
>
> Your robot is not doing well these days...
>
> greg k-h
> .
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-06 1:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 9:21 [PATCH -next] staging/speakup: Switch to kmemdup_nul() Yang Yingliang
2021-04-02 13:13 ` Greg KH
2021-04-06 1:53 ` Yang Yingliang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.