* [patch 1/3] early_printk - use sizeof instead of hardcoded number
[not found] <20090102082717.810810508@gmail.com>
@ 2009-01-02 8:27 ` Cyrill Gorcunov
2009-01-02 8:27 ` [patch 2/3] mm: hugetlb -- get rid of redundant if operation Cyrill Gorcunov
2009-01-02 8:27 ` [patch 3/3] acpi: check for pxm_to_node_map overflow Cyrill Gorcunov
2 siblings, 0 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2009-01-02 8:27 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, tglx; +Cc: gorcunov, Cyrill Gorcunov
[-- Attachment #1: x86-early_printk-buf-sizeof --]
[-- Type: text/plain, Size: 636 bytes --]
Impact: cleanup
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
---
arch/x86/kernel/early_printk.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.git/arch/x86/kernel/early_printk.c
===================================================================
--- linux-2.6.git.orig/arch/x86/kernel/early_printk.c
+++ linux-2.6.git/arch/x86/kernel/early_printk.c
@@ -886,7 +886,7 @@ asmlinkage void early_printk(const char
va_list ap;
va_start(ap, fmt);
- n = vscnprintf(buf, 512, fmt, ap);
+ n = vscnprintf(buf, sizeof(buf), fmt, ap);
early_console->write(early_console, buf, n);
va_end(ap);
}
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 2/3] mm: hugetlb -- get rid of redundant if operation
[not found] <20090102082717.810810508@gmail.com>
2009-01-02 8:27 ` [patch 1/3] early_printk - use sizeof instead of hardcoded number Cyrill Gorcunov
@ 2009-01-02 8:27 ` Cyrill Gorcunov
2009-01-02 9:22 ` Ingo Molnar
2009-01-02 8:27 ` [patch 3/3] acpi: check for pxm_to_node_map overflow Cyrill Gorcunov
2 siblings, 1 reply; 7+ messages in thread
From: Cyrill Gorcunov @ 2009-01-02 8:27 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, tglx; +Cc: gorcunov, Cyrill Gorcunov, William Irwin
[-- Attachment #1: mm-hugetlb --]
[-- Type: text/plain, Size: 684 bytes --]
At this point we already know that 'addr' is not NULL
so get rid of redundant 'if'. Probably gcc eliminate it
by optimization pass.
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: William Irwin <wli@holomorphy.com>
---
mm/hugetlb.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
Index: linux-2.6.git/mm/hugetlb.c
===================================================================
--- linux-2.6.git.orig/mm/hugetlb.c
+++ linux-2.6.git/mm/hugetlb.c
@@ -991,8 +991,7 @@ __attribute__((weak)) int alloc_bootmem_
* puts them into the mem_map).
*/
m = addr;
- if (m)
- goto found;
+ goto found;
}
hstate_next_node(h);
nr_nodes--;
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* [patch 3/3] acpi: check for pxm_to_node_map overflow
[not found] <20090102082717.810810508@gmail.com>
2009-01-02 8:27 ` [patch 1/3] early_printk - use sizeof instead of hardcoded number Cyrill Gorcunov
2009-01-02 8:27 ` [patch 2/3] mm: hugetlb -- get rid of redundant if operation Cyrill Gorcunov
@ 2009-01-02 8:27 ` Cyrill Gorcunov
2009-01-02 9:23 ` Ingo Molnar
2009-01-02 10:30 ` Cyrill Gorcunov
2 siblings, 2 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2009-01-02 8:27 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, tglx; +Cc: gorcunov, Cyrill Gorcunov, Len Brown
[-- Attachment #1: x86-acpi-pxm-overflow --]
[-- Type: text/plain, Size: 786 bytes --]
It is hardly (if ever) possible but in case of broken _PXM
entry we could reach out of pxm_to_node_map array
bounds in acpi_map_pxm_to_node() call. Lets check it
(it's not that expensive and safe).
Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
CC: Len Brown <lenb@kernel.org>
---
drivers/acpi/numa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Index: linux-2.6.git/drivers/acpi/numa.c
===================================================================
--- linux-2.6.git.orig/drivers/acpi/numa.c
+++ linux-2.6.git/drivers/acpi/numa.c
@@ -278,7 +278,7 @@ int acpi_get_node(acpi_handle *handle)
int pxm, node = -1;
pxm = acpi_get_pxm(handle);
- if (pxm >= 0)
+ if (pxm >= 0 && pxm < MAX_PXM_DOMAINS)
node = acpi_map_pxm_to_node(pxm);
return node;
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 2/3] mm: hugetlb -- get rid of redundant if operation
2009-01-02 8:27 ` [patch 2/3] mm: hugetlb -- get rid of redundant if operation Cyrill Gorcunov
@ 2009-01-02 9:22 ` Ingo Molnar
0 siblings, 0 replies; 7+ messages in thread
From: Ingo Molnar @ 2009-01-02 9:22 UTC (permalink / raw)
To: Cyrill Gorcunov, Andrew Morton
Cc: hpa, linux-kernel, tglx, Cyrill Gorcunov, William Irwin
Andrew Cc:-ed.
patch looks correct to me.
Reviewed-by: Ingo Molnar <mingo@elte.hu>
Ingo
* Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> At this point we already know that 'addr' is not NULL
> so get rid of redundant 'if'. Probably gcc eliminate it
> by optimization pass.
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> CC: William Irwin <wli@holomorphy.com>
> ---
> mm/hugetlb.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> Index: linux-2.6.git/mm/hugetlb.c
> ===================================================================
> --- linux-2.6.git.orig/mm/hugetlb.c
> +++ linux-2.6.git/mm/hugetlb.c
> @@ -991,8 +991,7 @@ __attribute__((weak)) int alloc_bootmem_
> * puts them into the mem_map).
> */
> m = addr;
> - if (m)
> - goto found;
> + goto found;
> }
> hstate_next_node(h);
> nr_nodes--;
>
> --
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 3/3] acpi: check for pxm_to_node_map overflow
2009-01-02 8:27 ` [patch 3/3] acpi: check for pxm_to_node_map overflow Cyrill Gorcunov
@ 2009-01-02 9:23 ` Ingo Molnar
2009-01-02 10:25 ` Cyrill Gorcunov
2009-01-02 10:30 ` Cyrill Gorcunov
1 sibling, 1 reply; 7+ messages in thread
From: Ingo Molnar @ 2009-01-02 9:23 UTC (permalink / raw)
To: Cyrill Gorcunov; +Cc: hpa, linux-kernel, tglx, Cyrill Gorcunov, Len Brown
* Cyrill Gorcunov <gorcunov@gmail.com> wrote:
> It is hardly (if ever) possible but in case of broken _PXM
> entry we could reach out of pxm_to_node_map array
> bounds in acpi_map_pxm_to_node() call. Lets check it
> (it's not that expensive and safe).
>
> Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
> CC: Len Brown <lenb@kernel.org>
> ---
> drivers/acpi/numa.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
just curious - how did you find this - code review or some tool help like
Sparse output or a compiler warning?
Ingo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 3/3] acpi: check for pxm_to_node_map overflow
2009-01-02 9:23 ` Ingo Molnar
@ 2009-01-02 10:25 ` Cyrill Gorcunov
0 siblings, 0 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2009-01-02 10:25 UTC (permalink / raw)
To: Ingo Molnar; +Cc: hpa, linux-kernel, tglx, Len Brown
[Ingo Molnar - Fri, Jan 02, 2009 at 10:23:30AM +0100]
|
| * Cyrill Gorcunov <gorcunov@gmail.com> wrote:
|
| > It is hardly (if ever) possible but in case of broken _PXM
| > entry we could reach out of pxm_to_node_map array
| > bounds in acpi_map_pxm_to_node() call. Lets check it
| > (it's not that expensive and safe).
| >
| > Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
| > CC: Len Brown <lenb@kernel.org>
| > ---
| > drivers/acpi/numa.c | 2 +-
| > 1 file changed, 1 insertion(+), 1 deletion(-)
|
| just curious - how did you find this - code review or some tool help like
| Sparse output or a compiler warning?
|
| Ingo
|
Unfortunately -- by reading the code :( I would prefer
if gcc or sparse complain about it but we have indirect
referring which is that hard to trace by any tool I believe
(until say some emulator but even if we have such kind of
tool we would need to tell it that 'there we have boundries
we shouldn't cross)'. But to be fair -- I didn't try sparse
here maybe it does complain :)
- Cyrill -
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [patch 3/3] acpi: check for pxm_to_node_map overflow
2009-01-02 8:27 ` [patch 3/3] acpi: check for pxm_to_node_map overflow Cyrill Gorcunov
2009-01-02 9:23 ` Ingo Molnar
@ 2009-01-02 10:30 ` Cyrill Gorcunov
1 sibling, 0 replies; 7+ messages in thread
From: Cyrill Gorcunov @ 2009-01-02 10:30 UTC (permalink / raw)
To: mingo, hpa, linux-kernel, tglx, Len Brown; +Cc: Andi Kleen
[Cyrill Gorcunov - Fri, Jan 02, 2009 at 11:27:20AM +0300]
| It is hardly (if ever) possible but in case of broken _PXM
| entry we could reach out of pxm_to_node_map array
| bounds in acpi_map_pxm_to_node() call. Lets check it
| (it's not that expensive and safe).
|
| Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
| CC: Len Brown <lenb@kernel.org>
...
Oops, I forgot to CC Andi, sorry.
- Cyrill -
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2009-01-02 10:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20090102082717.810810508@gmail.com>
2009-01-02 8:27 ` [patch 1/3] early_printk - use sizeof instead of hardcoded number Cyrill Gorcunov
2009-01-02 8:27 ` [patch 2/3] mm: hugetlb -- get rid of redundant if operation Cyrill Gorcunov
2009-01-02 9:22 ` Ingo Molnar
2009-01-02 8:27 ` [patch 3/3] acpi: check for pxm_to_node_map overflow Cyrill Gorcunov
2009-01-02 9:23 ` Ingo Molnar
2009-01-02 10:25 ` Cyrill Gorcunov
2009-01-02 10:30 ` Cyrill Gorcunov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox