* [PATCH] staging: android: ion: Replace strncpy() for stracpy()
@ 2019-09-08 4:34 Adam Zerella
2019-09-10 11:55 ` Dan Carpenter
0 siblings, 1 reply; 2+ messages in thread
From: Adam Zerella @ 2019-09-08 4:34 UTC (permalink / raw)
To: labbott, sumit.semwal
Cc: gregkh, devel, dri-devel, linaro-mm-sig, linux-kernel, Adam Zerella
Using strncpy() does not always terminate the destination string.
stracpy() is a alternative function that does, by using this new
function we will no longer need to insert a null separator.
Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
---
drivers/staging/android/ion/ion.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index e6b1ca141b93..17901bd626be 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -433,8 +433,7 @@ static int ion_query_heaps(struct ion_heap_query *query)
max_cnt = query->cnt;
plist_for_each_entry(heap, &dev->heaps, node) {
- strncpy(hdata.name, heap->name, MAX_HEAP_NAME);
- hdata.name[sizeof(hdata.name) - 1] = '\0';
+ stracpy(hdata.name, heap->name, MAX_HEAP_NAME);
hdata.type = heap->type;
hdata.heap_id = heap->id;
--
2.21.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] staging: android: ion: Replace strncpy() for stracpy()
2019-09-08 4:34 [PATCH] staging: android: ion: Replace strncpy() for stracpy() Adam Zerella
@ 2019-09-10 11:55 ` Dan Carpenter
0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2019-09-10 11:55 UTC (permalink / raw)
To: Adam Zerella
Cc: labbott, sumit.semwal, devel, gregkh, linux-kernel, dri-devel,
linaro-mm-sig
On Sun, Sep 08, 2019 at 02:34:50PM +1000, Adam Zerella wrote:
> Using strncpy() does not always terminate the destination string.
> stracpy() is a alternative function that does, by using this new
> function we will no longer need to insert a null separator.
>
> Signed-off-by: Adam Zerella <adam.zerella@gmail.com>
> ---
> drivers/staging/android/ion/ion.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e6b1ca141b93..17901bd626be 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -433,8 +433,7 @@ static int ion_query_heaps(struct ion_heap_query *query)
> max_cnt = query->cnt;
>
> plist_for_each_entry(heap, &dev->heaps, node) {
> - strncpy(hdata.name, heap->name, MAX_HEAP_NAME);
> - hdata.name[sizeof(hdata.name) - 1] = '\0';
> + stracpy(hdata.name, heap->name, MAX_HEAP_NAME);
stracpy() only takes two arguments. This doesn't compile.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-09-10 11:56 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-08 4:34 [PATCH] staging: android: ion: Replace strncpy() for stracpy() Adam Zerella
2019-09-10 11:55 ` Dan Carpenter
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).