* [PATCH 1/2] [IA64] Fix zeroing of PDAs
@ 2014-07-28 15:01 Thierry Reding
2014-07-28 15:01 ` [PATCH 2/2] [IA64] Do not needlessly convert between pointers and integers Thierry Reding
0 siblings, 1 reply; 2+ messages in thread
From: Thierry Reding @ 2014-07-28 15:01 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel
From: Thierry Reding <treding@nvidia.com>
The code uses a the following to zero out a PDA:
memset(pda, 0, sizeof(pda));
But sizeof(pda) will return the size of a pointer rather than the size
of the structure pointed to. This triggers the following warning from
GCC:
arch/ia64/sn/kernel/setup.c:582:23: warning: argument to 'sizeof' in 'memset' call is the same pointer type 'struct pda_s *' as the destination; expected 'struct pda_s' or an explicit length [-Wsizeof-pointer-memaccess]
memset(pda, 0, sizeof(pda));
^
Fix this by passing in the size of the structure using sizeof(*pda)
instead.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
arch/ia64/sn/kernel/setup.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 53b01b8e2f19..36182c84363c 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -579,7 +579,7 @@ void sn_cpu_init(void)
(sn_prom_type = 1) ? "real" : "fake");
}
- memset(pda, 0, sizeof(pda));
+ memset(pda, 0, sizeof(*pda));
if (ia64_sn_get_sn_info(0, &sn_hub_info->shub2,
&sn_hub_info->nasid_bitmask,
&sn_hub_info->nasid_shift,
--
2.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH 2/2] [IA64] Do not needlessly convert between pointers and integers
2014-07-28 15:01 [PATCH 1/2] [IA64] Fix zeroing of PDAs Thierry Reding
@ 2014-07-28 15:01 ` Thierry Reding
0 siblings, 0 replies; 2+ messages in thread
From: Thierry Reding @ 2014-07-28 15:01 UTC (permalink / raw)
To: Tony Luck, Fenghua Yu; +Cc: linux-ia64, linux-kernel
From: Thierry Reding <treding@nvidia.com>
The nasid_to_try variable is an array of integers, so plain integers can
be used when assigning values to the elements rather than casting a NULL
pointer to an integer, which results in the following warning from GCC:
arch/ia64/sn/kernel/bte.c:117:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
nasid_to_try[1] = (int)NULL;
^
arch/ia64/sn/kernel/bte.c:125:22: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
nasid_to_try[1] = (int)NULL;
^
Replace (int)NULL with a simple 0 to silence these warnings.
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
arch/ia64/sn/kernel/bte.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/ia64/sn/kernel/bte.c b/arch/ia64/sn/kernel/bte.c
index cad775a1a157..b2eb48490754 100644
--- a/arch/ia64/sn/kernel/bte.c
+++ b/arch/ia64/sn/kernel/bte.c
@@ -114,7 +114,7 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
if (mode & BTE_USE_ANY) {
nasid_to_try[1] = my_nasid;
} else {
- nasid_to_try[1] = (int)NULL;
+ nasid_to_try[1] = 0;
}
} else {
/* try local then remote */
@@ -122,7 +122,7 @@ bte_result_t bte_copy(u64 src, u64 dest, u64 len, u64 mode, void *notification)
if (mode & BTE_USE_ANY) {
nasid_to_try[1] = NASID_GET(dest);
} else {
- nasid_to_try[1] = (int)NULL;
+ nasid_to_try[1] = 0;
}
}
--
2.0.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-07-28 15:01 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-28 15:01 [PATCH 1/2] [IA64] Fix zeroing of PDAs Thierry Reding
2014-07-28 15:01 ` [PATCH 2/2] [IA64] Do not needlessly convert between pointers and integers Thierry Reding
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox