From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965829AbcIWNXZ (ORCPT ); Fri, 23 Sep 2016 09:23:25 -0400 Received: from mail-wm0-f42.google.com ([74.125.82.42]:35163 "EHLO mail-wm0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965649AbcIWNXY (ORCPT ); Fri, 23 Sep 2016 09:23:24 -0400 From: Alexander Potapenko To: dvyukov@google.com, kcc@google.com, akpm@linux-foundation.org, edumazet@google.com, mingo@elte.hu Cc: linux-kernel@vger.kernel.org Subject: [PATCH 0/2] Clang: avoid undefined behavior in llist iterators Date: Fri, 23 Sep 2016 15:22:56 +0200 Message-Id: <1474636978-41435-1-git-send-email-glider@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch set fixes problems with pointer arithmetics overflow in llist iterators, llist_for_each_entry() and llist_for_each_entry_safe(). Clang turns those macros into infinite loops, because they're operating with "negative" pointers. As a follow-up it may make sense to convert other uses of llist_entry() to llist_entry_safe(), or even replace uses of container_of() with container_of_safe(). Alexander Potapenko (2): include/linux: provide a safe version of container_of() llist: introduce llist_entry_safe() include/linux/kernel.h | 15 +++++++++++++++ include/linux/llist.h | 26 +++++++++++++++++++------- 2 files changed, 34 insertions(+), 7 deletions(-) -- 2.8.0.rc3.226.g39d4020