* [PATCH] s5p-jpeg: fix uninitialized use in hdr parse
@ 2013-10-10 7:06 Seung-Woo Kim
2013-10-12 9:39 ` Sylwester Nawrocki
0 siblings, 1 reply; 5+ messages in thread
From: Seung-Woo Kim @ 2013-10-10 7:06 UTC (permalink / raw)
To: linux-media, linux-samsung-soc, m.chehab, s.nawrocki; +Cc: sw0312.kim
For hdr parse error, it can return false without any assignments
which cause build warning.
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 15d2396..7db374e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -442,14 +442,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
while (notfound) {
c = get_byte(&jpeg_buffer);
if (c == -1)
- break;
+ return false;
if (c != 0xff)
continue;
do
c = get_byte(&jpeg_buffer);
while (c == 0xff);
if (c == -1)
- break;
+ return false;
if (c == 0)
continue;
length = 0;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] s5p-jpeg: fix uninitialized use in hdr parse
2013-10-10 7:06 [PATCH] s5p-jpeg: fix uninitialized use in hdr parse Seung-Woo Kim
@ 2013-10-12 9:39 ` Sylwester Nawrocki
2013-10-14 4:27 ` Seung-Woo Kim
2013-10-14 4:43 ` [PATCH v2] " Seung-Woo Kim
0 siblings, 2 replies; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-10-12 9:39 UTC (permalink / raw)
To: Seung-Woo Kim; +Cc: linux-media, linux-samsung-soc, s.nawrocki
Hi Seung-Woo,
On 10/10/2013 09:06 AM, Seung-Woo Kim wrote:
> For hdr parse error, it can return false without any assignments
> which cause build warning.
>
> Signed-off-by: Seung-Woo Kim<sw0312.kim@samsung.com>
> ---
> drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> index 15d2396..7db374e 100644
> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
> @@ -442,14 +442,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
> while (notfound) {
> c = get_byte(&jpeg_buffer);
> if (c == -1)
> - break;
> + return false;
notfound is being assigned before entering the while loop, so I'm not sure
what exactly is not correct here. Can you quote the original build
warning ?
It's a good idea to always include compiler errors/warnings in the commit
message.
BTW, name of the variable is a bit confusing, I think naming it 'found' and
using negation of it would be easier to follow; that's not something we'd
be changing now though.
> if (c != 0xff)
> continue;
> do
> c = get_byte(&jpeg_buffer);
> while (c == 0xff);
> if (c == -1)
> - break;
> + return false;
> if (c == 0)
> continue;
> length = 0;
Thanks,
Sylwester
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] s5p-jpeg: fix uninitialized use in hdr parse
2013-10-12 9:39 ` Sylwester Nawrocki
@ 2013-10-14 4:27 ` Seung-Woo Kim
2013-10-14 4:43 ` [PATCH v2] " Seung-Woo Kim
1 sibling, 0 replies; 5+ messages in thread
From: Seung-Woo Kim @ 2013-10-14 4:27 UTC (permalink / raw)
To: Sylwester Nawrocki
Cc: linux-media, linux-samsung-soc, s.nawrocki, Seung-Woo Kim
Hi Sylwester,
Thanks for you comment.
On 2013년 10월 12일 18:39, Sylwester Nawrocki wrote:
> Hi Seung-Woo,
>
> On 10/10/2013 09:06 AM, Seung-Woo Kim wrote:
>> For hdr parse error, it can return false without any assignments
>> which cause build warning.
>>
>> Signed-off-by: Seung-Woo Kim<sw0312.kim@samsung.com>
>> ---
>> drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
>> 1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> b/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> index 15d2396..7db374e 100644
>> --- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> +++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
>> @@ -442,14 +442,14 @@ static bool s5p_jpeg_parse_hdr(struct
>> s5p_jpeg_q_data *result,
>> while (notfound) {
>> c = get_byte(&jpeg_buffer);
>> if (c == -1)
>> - break;
>> + return false;
>
> notfound is being assigned before entering the while loop, so I'm not sure
> what exactly is not correct here. Can you quote the original build
> warning ?
Here is the build warning.
drivers/media/platform/s5p-jpeg/jpeg-core.c: In function
's5p_jpeg_parse_hdr':
drivers/media/platform/s5p-jpeg/jpeg-core.c:432: warning: 'components'
may be used uninitialized in this function
drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'height' may
be used uninitialized in this function
drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'width' may be
used uninitialized in this function
> It's a good idea to always include compiler errors/warnings in the commit
> message.
Right, I'll repost with warning message.
>
> BTW, name of the variable is a bit confusing, I think naming it 'found' and
> using negation of it would be easier to follow; that's not something we'd
> be changing now though.
>
>> if (c != 0xff)
>> continue;
>> do
>> c = get_byte(&jpeg_buffer);
>> while (c == 0xff);
>> if (c == -1)
>> - break;
>> + return false;
>> if (c == 0)
>> continue;
>> length = 0;
>
> Thanks,
> Sylwester
>
--
Seung-Woo Kim
Samsung Software R&D Center
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2] s5p-jpeg: fix uninitialized use in hdr parse
2013-10-12 9:39 ` Sylwester Nawrocki
2013-10-14 4:27 ` Seung-Woo Kim
@ 2013-10-14 4:43 ` Seung-Woo Kim
2013-10-15 7:44 ` Sylwester Nawrocki
1 sibling, 1 reply; 5+ messages in thread
From: Seung-Woo Kim @ 2013-10-14 4:43 UTC (permalink / raw)
To: linux-media, linux-samsung-soc, m.chehab, s.nawrocki; +Cc: sw0312.kim
For hdr parse error, it can return false without any assignments
which cause following build warning.
drivers/media/platform/s5p-jpeg/jpeg-core.c: In function 's5p_jpeg_parse_hdr':
drivers/media/platform/s5p-jpeg/jpeg-core.c:432: warning: 'components' may be used uninitialized in this function
drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'height' may be used uninitialized in this function
drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'width' may be used uninitialized in this function
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
---
change from v1
- add build warning to commit message
---
drivers/media/platform/s5p-jpeg/jpeg-core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/media/platform/s5p-jpeg/jpeg-core.c b/drivers/media/platform/s5p-jpeg/jpeg-core.c
index 15d2396..7db374e 100644
--- a/drivers/media/platform/s5p-jpeg/jpeg-core.c
+++ b/drivers/media/platform/s5p-jpeg/jpeg-core.c
@@ -442,14 +442,14 @@ static bool s5p_jpeg_parse_hdr(struct s5p_jpeg_q_data *result,
while (notfound) {
c = get_byte(&jpeg_buffer);
if (c == -1)
- break;
+ return false;
if (c != 0xff)
continue;
do
c = get_byte(&jpeg_buffer);
while (c == 0xff);
if (c == -1)
- break;
+ return false;
if (c == 0)
continue;
length = 0;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2] s5p-jpeg: fix uninitialized use in hdr parse
2013-10-14 4:43 ` [PATCH v2] " Seung-Woo Kim
@ 2013-10-15 7:44 ` Sylwester Nawrocki
0 siblings, 0 replies; 5+ messages in thread
From: Sylwester Nawrocki @ 2013-10-15 7:44 UTC (permalink / raw)
To: Seung-Woo Kim, linux-media, linux-samsung-soc, m.chehab
Hi Seung-Woo,
On 14/10/13 06:43, Seung-Woo Kim wrote:
> For hdr parse error, it can return false without any assignments
> which cause following build warning.
>
> drivers/media/platform/s5p-jpeg/jpeg-core.c: In function 's5p_jpeg_parse_hdr':
> drivers/media/platform/s5p-jpeg/jpeg-core.c:432: warning: 'components' may be used uninitialized in this function
> drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'height' may be used uninitialized in this function
> drivers/media/platform/s5p-jpeg/jpeg-core.c:433: warning: 'width' may be used uninitialized in this function
>
> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
> ---
> change from v1
> - add build warning to commit message
Thanks for amending it, the patch added to my tree for v3.13.
--
Regards,
Sylwester
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2013-10-15 7:44 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-10-10 7:06 [PATCH] s5p-jpeg: fix uninitialized use in hdr parse Seung-Woo Kim
2013-10-12 9:39 ` Sylwester Nawrocki
2013-10-14 4:27 ` Seung-Woo Kim
2013-10-14 4:43 ` [PATCH v2] " Seung-Woo Kim
2013-10-15 7:44 ` Sylwester Nawrocki
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).