From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82763C433EF for ; Fri, 11 Feb 2022 18:35:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344254AbiBKSfT (ORCPT ); Fri, 11 Feb 2022 13:35:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240176AbiBKSfS (ORCPT ); Fri, 11 Feb 2022 13:35:18 -0500 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1028184 for ; Fri, 11 Feb 2022 10:35:16 -0800 (PST) Received: by mail-pf1-x436.google.com with SMTP id t36so6926041pfg.0 for ; Fri, 11 Feb 2022 10:35:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Law23MJZOOc1DSHm8VR9H3GrGJ66ArnHrnubRrOHPvQ=; b=grWpmNuAVAUNtXU+FnSt5b2Kn8aHJGFT1lR4959Vnw252ve2fpXQdIQ1kKb9yyPsmj RjwZFCQyZEfz6QZrdvPykM7QMkILoVaMcB3I/reCjgwP9ibSX7Rm7jSqLK5ev4mBzMuX LCSgqiAf3O/nFQXdLbc2KnG1uDsUmHvcBXlfO4Zn8Tn5wy0P7uls6AEoTgzK9sDmPHD9 F5Ru1rSopIiSU2odYtukvpeanVTE+A1xa52+MDJIDAYT/wdFBHTOnnvJdoE2GeK4uKnO NAtawK9G852cwmGmHkER95Fx7y6Q8lNaY0Gk97hPCF7lNfns17Bt3Nrv76Y2ko6BydCW Fpwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Law23MJZOOc1DSHm8VR9H3GrGJ66ArnHrnubRrOHPvQ=; b=6Nf2QCfIOQINzErvbrrqtzG/7v1WAnbaMqWp39QIIGWPv9v4DJZrQ44530q8WoGhy/ jPr8jQ+P771SeAWvfw+1c8T16USlUieU476vs3CbSL66emKgnqrzk7jI3u5R79ib0Kvz DcIZuXvTh5OTAmTFNFJH/GKTdTJKJap41EsBOMvB2Tqh5LIyQa3qriU6dbwPyjlI1jHm 62r/BLKXJclrp6qbTnmZ0TLGYLsWHi3v2tiYnEXTTQAeKQ5nEKM3Xs16rDdLm2pE1z3W Z9DRfbeprmE/rPUohpAPn57G+/6YhBRDBxhqfrbimzE0sdn3qnCbxvxKAlL6JFxfjAXQ Oxzg== X-Gm-Message-State: AOAM530OYmmc9gBb/nACa4VDwPT58xRCH7Qwg6w+9lfBaXl85QU4S++M GSUS5y70gsZzbw4cuHHo6PgKHfiCkGzU79cu X-Google-Smtp-Source: ABdhPJz9XjGGUoTT/A2yzk9UDf0bjt//XEvmMyyYGB/gObDSgPewX+GURAnz6BGO+twFLqCsJYmNjg== X-Received: by 2002:a05:6a00:1a16:: with SMTP id g22mr2987950pfv.81.1644604516227; Fri, 11 Feb 2022 10:35:16 -0800 (PST) Received: from hermes.local (204-195-112-199.wavecable.com. [204.195.112.199]) by smtp.gmail.com with ESMTPSA id g19sm9738509pfc.109.2022.02.11.10.35.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 10:35:15 -0800 (PST) Date: Fri, 11 Feb 2022 10:35:13 -0800 From: Stephen Hemminger To: Maxim Petrov Cc: netdev@vger.kernel.org Subject: Re: [PATCH iproute2] libnetlink: fix socket leak in rtnl_open_byproto() Message-ID: <20220211103513.2ebc5615@hermes.local> In-Reply-To: <8da15fe8-92be-ee9c-0c45-1a4af38fc9bd@gmail.com> References: <20220210171903.66f35b6c@hermes.local> <8da15fe8-92be-ee9c-0c45-1a4af38fc9bd@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Fri, 11 Feb 2022 21:30:11 +0300 Maxim Petrov wrote: > Hello Stephen! > > On 2022-02-11 01:19 UTC, Stephen Hemminger wrote: > > + } else { > > + rth->seq = time(NULL); > > + return 0; > > } > > For me it looks slightly alien as the normal flow jumps from one 'else if' to > another, and the final return statement is hidden inside the else block. The > original version is straightforward and less surprising. > > > Can do the same thing without introducing a goto > But what's wrong with the goto here? I thought it is a perfectly legal C way to > handle errors, and iproute2 uses it for that purpose almost everywhere. Ok, either way. personal preference only.