From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Hemminger Subject: Re: [PATCH][net-next] ipv6: drop container_of when convert dst to rt6_info Date: Sun, 30 Sep 2018 11:32:52 +0200 Message-ID: <20180930113252.7159eedd@shemminger-XPS-13-9360> References: <1538283772-23985-1-git-send-email-lirongqing@baidu.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: Li RongQing Return-path: Received: from mail-wm1-f68.google.com ([209.85.128.68]:50246 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727852AbeI3QFP (ORCPT ); Sun, 30 Sep 2018 12:05:15 -0400 Received: by mail-wm1-f68.google.com with SMTP id s12-v6so5903612wmc.0 for ; Sun, 30 Sep 2018 02:32:59 -0700 (PDT) In-Reply-To: <1538283772-23985-1-git-send-email-lirongqing@baidu.com> Sender: netdev-owner@vger.kernel.org List-ID: On Sun, 30 Sep 2018 13:02:52 +0800 Li RongQing wrote: > we can save container_of computation and return dst directly, > since dst is always first member of struct rt6_info > > Add a BUILD_BUG_ON() to catch any change that could break this > assertion. > > Signed-off-by: Li RongQing I don't understand why you are doing this? It is not going to be faster (or safer) than container_of. container_of provides the same functionality and is safe against position of the member in the structure.