Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4537093ybp; Mon, 14 Oct 2019 06:17:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+Bpd2r1lx6GLIMffvNP+aKAHd/H2ZlvUe17eutcGT6LgMF4JudxSPfzui89IB9fbMVd+i X-Received: by 2002:a50:8b45:: with SMTP id l63mr28518980edl.31.1571059036025; Mon, 14 Oct 2019 06:17:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571059036; cv=none; d=google.com; s=arc-20160816; b=PJsWJjpC0CyBCOjCVYDHkMqQ0xkdmomZkSCVksFCaOGRwneNXanXkOxKHAu/PKjJEc Mw1kqsSUp/RCeRr5UfdeXdQ/g7r8VryzwyvVQwybAFerQUxHLRBPAciWTkSRniBFA+Uq Z2qExCcBTtuilKUDGHblW1rNL8u0J7UO7QbLvP1R0jHiQK9L8KDAkDJNbnhCE3GwzR78 PINIFp4vFsLsjayYxWyI+S+uwDslwcXbOwVpViD+cXFg/786znrKb3PDG9JTkfdVE762 rvB+iJiShdon52amgn22xHe7kpa+tsR/KNvFy/k1n/1hOy6ut2cOb1urMzfAph9OQgR4 1b5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=rKzkD7UkgaWpOKYsj5nwSWLCziwC7D7d56zQ7swMrAI=; b=oUSeVoyxiB9j1lxuuiLWFaZKjucTxFd8YCE976Ydk8Yz8tc8Z0+BFlY/BejixW1lG5 7xD2168lX79Nb3+i3azB9noqz67Fjr/aIPhRDQQET8UP0s8cCukyq2NwqE+s5xKrCGzL OVbyFjLFFVn7UoaYLjuhOlH5d8esN1VsMnEG6AoS6wkqURVkrrqPRDTpU0z6o/2suiu9 C+G8JRaKhoVgDHL7Oc8XzmiRAmH3c2jobgbh5pq9rw5aSOzg/CftgU2lnzoUxYrgR6gi Cd142Rz7AXE6UewOGU5Y62G8jh7DI4Nq2f1/t2RcnwPJzdS5GUMGX22ZRVnjhk3LKAtz YSGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aX3aF1ab; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y16si11292431ejc.34.2019.10.14.06.16.51; Mon, 14 Oct 2019 06:17:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=aX3aF1ab; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731303AbfJNNQA (ORCPT + 99 others); Mon, 14 Oct 2019 09:16:00 -0400 Received: from mail-yw1-f65.google.com ([209.85.161.65]:39648 "EHLO mail-yw1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfJNNQA (ORCPT ); Mon, 14 Oct 2019 09:16:00 -0400 Received: by mail-yw1-f65.google.com with SMTP id n11so6083439ywn.6 for ; Mon, 14 Oct 2019 06:16:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=rKzkD7UkgaWpOKYsj5nwSWLCziwC7D7d56zQ7swMrAI=; b=aX3aF1abTrK4DZPP1VXH7V63n4tcARLqnCdHUIw/0zQcYGerbGphhMaV2qS0LD4ygj WmLTa6VBPfl9WEC0bsubnLXisKzrfkRaj2nPdnAGLbMHZpHHFMK/QByon8GcaLapqhaB Hh20NYRww/r9pbuaPcK0i7bBZhe7qFfk+q2gmZve1915bOxu5aDJlQbtRsrZmt/2BeHf m/Bl33FbTefIKsxnuKnaa9j1BhCYDXmgH1RTyLSrwjLNLYJphHUMDpZRufT5iH0cOq51 gkbfYMW53Zlrv4bSzDmpjgPQwa9JNdTg9hgV4hHmPvsMck4ed/oG9K9ZztrXSeE/0FVR VY7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=rKzkD7UkgaWpOKYsj5nwSWLCziwC7D7d56zQ7swMrAI=; b=I2Bb3vnqlO/eEIbqy3+1IgqdgMHB2wYgqTjkKLEqH5c7PgZUSCozz/RdMxT2jBy0ro QVmDHP0yqn7rTWxilfINgOe8j2E7wzvdTPEJxfa0cTXhRc8qxLekT2iOlEI4w3EZcO9R ms829esTJ5PmRW5437kGtGZtpw6t5MoUbW+rl1F0I8zsT1jN904db5LPsGpjAdX10Csi wZlyRbledtp4/7ryVX4Bl53HPeZp1pFEZTrxG1xH2Vyhtzeb16yJNwFXPnbuvlINPp6Y l+lbJA6Cw47KRi33gfOU8H8gfpcx9H5iudvAnafokVbQyMWvznBUx+GZ0qW6c4PIdLLo Klkg== X-Gm-Message-State: APjAAAUPvn27dyds9T5a7Uhigvy6NwaQ1u1vDzZH9/gKRG4MwmvuMg5C aRTqojF0iD+2fA0CsmLkiXwILw/3c0w75g5UjdvXyA== X-Received: by 2002:a0d:ca0b:: with SMTP id m11mr12506127ywd.466.1571058959291; Mon, 14 Oct 2019 06:15:59 -0700 (PDT) MIME-Version: 1.0 References: <124b41aa-7ba5-f00c-ab73-cb8e6a2ae75f@gmail.com> <0984a481-f5eb-4346-fb98-718174c55e36@gmail.com> <248c2ca6-0c27-dc62-6d20-49c87f0af15f@web.de> In-Reply-To: <248c2ca6-0c27-dc62-6d20-49c87f0af15f@web.de> From: Eric Dumazet Date: Mon, 14 Oct 2019 06:15:48 -0700 Message-ID: Subject: Re: tcp: Checking a kmemdup() call in tcp_time_wait() To: Markus Elfring Cc: Eric Dumazet , netdev , Alexei Starovoitov , Alexey Kuznetsov , Daniel Borkmann , "David S. Miller" , Hideaki Yoshifuji , Martin KaFai Lau , Song Liu , Yonghong Song , kernel-janitors@vger.kernel.org, LKML , Aditya Pakki , Kangjie Lu , Navid Emamdoost , Stephen McCamant Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Oct 14, 2019 at 5:51 AM Markus Elfring wrot= e: > > >>>> https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/t= ree/net/ipv4/tcp_minisocks.c?id=3D1c0cc5f1ae5ee5a6913704c0d75a6e99604ee30a#= n306 > >>>> https://elixir.bootlin.com/linux/v5.4-rc2/source/net/ipv4/tcp_miniso= cks.c#L306 > =E2=80=A6 > > >> Can an other error reporting approach be nicer here? > > > > There is no error reported if kmemdup() has failed. > > How do data from the Linux allocation failure report fit to this informat= ion? > https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/D= ocumentation/process/coding-style.rst?id=3D4f5cafb5cb8471e54afdc9054d973535= 614f7675#n878 > This is coding style for newly submitted code. We do not refactor code to the latest coding style, this would cost a lot. Especially TCP stack that is quite often changed. > > > timewait is best effort. > > How do you think about to return an error code like =E2=80=9C-ENOMEM=E2= =80=9D at this place? tcp_time_wait() is void, the caller won't care. I told you time_wait is best effort. What is the problem you want to solve _exactly_ ? Have you seen a real issue, or should you augment your static analyser to not complain on : ptr =3D kmemdup(); BUG_ON(); ( being different than (ptr =3D=3D NULL)) I believe we have enough real bugs to fix. I would prefer to not spend time arguing for every single BUG() or BUG_ON()= . Thank you.