From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f67.google.com ([209.85.160.67]:35624 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751960AbeBZD2V (ORCPT ); Sun, 25 Feb 2018 22:28:21 -0500 Received: by mail-pl0-f67.google.com with SMTP id bb3so8518704plb.2 for ; Sun, 25 Feb 2018 19:28:20 -0800 (PST) Subject: Re: [PATCH iproute2-next v3 5/8] veth,vxcan: Save/reinitialize/restore whole @struct ifinfomsg To: Serhey Popovych , netdev@vger.kernel.org References: <1519304526-18848-1-git-send-email-serhe.popovych@gmail.com> <1519304526-18848-6-git-send-email-serhe.popovych@gmail.com> From: David Ahern Message-ID: <21860aaf-41a1-4a40-2f5f-01fc5ae033ea@gmail.com> Date: Sun, 25 Feb 2018 20:28:14 -0700 MIME-Version: 1.0 In-Reply-To: <1519304526-18848-6-git-send-email-serhe.popovych@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: On 2/22/18 6:02 AM, Serhey Popovych wrote: > Now in iplink_parse() we use ->ifi_change and ->ifi_flags fields and > plan to use ->ifi_index with upcoming change. > > Saving, restoring and reinitializing individual fields is error prone: > using new field in iplink_parse() without updating callers in veth and > vxcan will overwrite main device ifinfomsg data. > > Since @struct ifinfomsg is small enough with known sizeof() compiler may > inline memcpy()/memset() with few load/store instructions. > > Signed-off-by: Serhey Popovych > --- > ip/iplink_vxcan.c | 22 ++++++++-------------- > ip/link_veth.c | 22 ++++++++-------------- > 2 files changed, 16 insertions(+), 28 deletions(-) I don't agree that this change has any benefit. Only the flags and change field are wanted; there is no need to save the entire struct,