From: Magnus Fromreide <magfr at lysator.liu.se>
To: powertop@lists.01.org
Subject: Re: [Powertop] [PATCH 1/2] Updates to support Android platform
Date: Tue, 18 Sep 2012 07:23:11 +0200 [thread overview]
Message-ID: <1347945791.3210.9.camel@sara> (raw)
In-Reply-To: CA+Z25wU4UMNYCR7hR2LWDhSprArsSk8U=rKrGRNCM-+hYHhTRA@mail.gmail.com
[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]
On Tue, 2012-09-18 at 09:54 +0530, Rajagopal Venkat wrote:
> On 17 September 2012 21:58, Chris Ferron <chris.e.ferron(a)linux.intel.com> wrote:
> > On 09/17/2012 07:34 AM, Rajagopal Venkat wrote:
> >>
> >> #include "devices/device.h"
> >> diff --git a/src/process/do_process.cpp b/src/process/do_process.cpp
> >> index eaef7f1..c9d6b0b 100644
> >> --- a/src/process/do_process.cpp
> >> +++ b/src/process/do_process.cpp
> >> @@ -869,7 +869,7 @@ void process_update_display(void)
> >> if (!show_power)
> >> strcpy(power, " ");
> >> sprintf(name, "%s", all_power[i]->type());
> >> - while (mbstowcs(NULL,name,0) < 14) strcat(name, " ");
> >> + while (mbstowcs(NULL,name,20) < 14) strcat(name, " ");
> >>
> >
> > mbstowcs(NULL,name,0) is a test. return will be count. while catches the
> > error.
>
> Agree. The Android bionic libc version of mbstowcs always returns zero if
> max(third parameter) is zero, resulting in infinite loop.
Have you reported the bug in the library to Google? If the first
argument is NULL posix says the third argument should be ignored.
What happens if 'name' is more than 20 characters? It shouldn't affect
this use of mbstowcs but there might be others.
> I believe this change should not cause any adverse effect on current behavior.
> The mbstowcs would stop parsing source string when it encounters null-character
> or max len. Atleast I didn't observe any change in return value(count).
It shouldn't change the behaviour since mbstowcs is required to ignore
it's third argument if the first argument is NULL.
/MF
next reply other threads:[~2012-09-18 5:23 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-18 5:23 Magnus Fromreide [this message]
-- strict thread matches above, loose matches on Subject: below --
2012-09-24 12:22 [Powertop] [PATCH 1/2] Updates to support Android platform Rajagopal Venkat
2012-09-18 13:26 Arjan van de Ven
2012-09-18 8:11 Sergey Senozhatsky
2012-09-18 5:58 Rajagopal Venkat
2012-09-18 5:53 Rajagopal Venkat
2012-09-18 5:43 Magnus Fromreide
2012-09-18 4:24 Rajagopal Venkat
2012-09-18 3:50 Rajagopal Venkat
2012-09-17 16:28 Chris Ferron
2012-09-17 15:59 Arjan van de Ven
2012-09-17 14:54 Sergey Senozhatsky
2012-09-17 14:34 Rajagopal Venkat
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=1347945791.3210.9.camel@sara \
--to=powertop@lists.01.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 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.