[PATCH v2] zsmalloc: use U suffix for negative literals being shifted

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixes warnings about shifting unsigned literals being undefined
behavior.

Suggested-by: Minchan Kim <minchan@xxxxxxxxxx>
Signed-off-by: Nick Desaulniers <nick.desaulniers@xxxxxxxxx>
---
Changes since v1:
* Use L suffix in addition to U, as suggested (link->next is unsigned long).

 mm/zsmalloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 683c065..b9040bd 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1057,7 +1057,7 @@ static void init_zspage(struct size_class *class, struct zspage *zspage)
 			 * Reset OBJ_TAG_BITS bit to last link to tell
 			 * whether it's allocated object or not.
 			 */
-			link->next = -1 << OBJ_TAG_BITS;
+			link->next = -1UL << OBJ_TAG_BITS;
 		}
 		kunmap_atomic(vaddr);
 		page = next_page;
-- 
2.7.4

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux