Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1244646 > unrolled thread
| Started by | Liao Tonglang <liaotonglang@gmail.com> |
|---|---|
| First post | 2015-10-12 14:30 +0200 |
| Last post | 2015-10-13 03:50 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized Liao Tonglang <liaotonglang@gmail.com> - 2015-10-12 14:30 +0200
Re: [PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized Jan Kara <jack@suse.cz> - 2015-10-12 15:00 +0200
Re: [PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized Liao Tonglang <liaotonglang@gmail.com> - 2015-10-13 03:50 +0200
| From | Liao Tonglang <liaotonglang@gmail.com> |
|---|---|
| Date | 2015-10-12 14:30 +0200 |
| Subject | [PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized |
| Message-ID | <qiKoP-7fZ-35@gated-at.bofh.it> |
Variables m_thresh and m_dirty in function balance_dirty_pages() may use
uninitialized. GCC throws a warning on it. Fixed by assigned to 0 as
initial value.
Signed-off-by: Liao Tonglang <liaotonglang@gmail.com>
---
mm/page-writeback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 0a931cd..288db45 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -1534,7 +1534,7 @@ static void balance_dirty_pages(struct address_space *mapping,
for (;;) {
unsigned long now = jiffies;
unsigned long dirty, thresh, bg_thresh;
- unsigned long m_dirty, m_thresh, m_bg_thresh;
+ unsigned long m_dirty = 0, m_thresh = 0, m_bg_thresh;
/*
* Unstable writes are a feature of certain networked
--
1.8.3.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Jan Kara <jack@suse.cz> |
|---|---|
| Date | 2015-10-12 15:00 +0200 |
| Subject | Re: [PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized |
| Message-ID | <qiKRQ-7QK-19@gated-at.bofh.it> |
| In reply to | #1244646 |
On Mon 12-10-15 20:24:58, Liao Tonglang wrote:
> Variables m_thresh and m_dirty in function balance_dirty_pages() may use
> uninitialized. GCC throws a warning on it. Fixed by assigned to 0 as
> initial value.
The code is correct - m_dirty & m_thresh gets set & used only if mdtc is
set. So the warning is false positive (and e.g. my gcc doesn't warn). What
gcc version are you using?
Honza
>
> Signed-off-by: Liao Tonglang <liaotonglang@gmail.com>
> ---
> mm/page-writeback.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 0a931cd..288db45 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -1534,7 +1534,7 @@ static void balance_dirty_pages(struct address_space *mapping,
> for (;;) {
> unsigned long now = jiffies;
> unsigned long dirty, thresh, bg_thresh;
> - unsigned long m_dirty, m_thresh, m_bg_thresh;
> + unsigned long m_dirty = 0, m_thresh = 0, m_bg_thresh;
>
> /*
> * Unstable writes are a feature of certain networked
> --
> 1.8.3.1
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | Liao Tonglang <liaotonglang@gmail.com> |
|---|---|
| Date | 2015-10-13 03:50 +0200 |
| Subject | Re: [PATCH] mm: cleanup balance_dirty_pages() that leave variables uninitialized |
| Message-ID | <qiWT0-4U-23@gated-at.bofh.it> |
| In reply to | #1244665 |
On 2015/10/12 20:58, Jan Kara wrote:
> What
> gcc version are you using?
It is the last line of my gcc -v command.
gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC)
And it warn like this:
mm/page-writeback.c: In function ‘balance_dirty_pages.isra.26’:
mm/page-writeback.c:1537:26: warning: ‘m_thresh’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
unsigned long m_dirty, m_thresh, m_bg_thresh;
^
mm/page-writeback.c:1537:17: warning: ‘m_dirty’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
unsigned long m_dirty, m_thresh, m_bg_thresh;
^
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web