Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp1213341imm; Wed, 23 May 2018 12:09:29 -0700 (PDT) X-Google-Smtp-Source: AB8JxZow0W2+6xQ8/KXTziYCgjAL40FXBaS0PihtDIXMVjanDUXUGLyiYqsE5QpE/b4qm3ozHMZx X-Received: by 2002:a17:902:543:: with SMTP id 61-v6mr4139790plf.47.1527102569632; Wed, 23 May 2018 12:09:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527102569; cv=none; d=google.com; s=arc-20160816; b=IgVZ74XjQoPE9YSyC55dP/7jNYhjMd0ZzN1A17zrNAlyoibkWmNnUQ6NDQ8MJQYTv9 x7AmtqcSgr/R0U4mUIp0F/0In28LCfO3e0IUGk8DKqEz/ZiPy+az7Le/W5RxiWEq9zhN nGfT7XAJnqcCjEN6j11XSXq72epNkwa9ExWPqB5jXuEL0RSuBUgoLp2wot/k+y75Y36U qzwieeEl01TOCbTAUHKesVbfXQFgdmJosfKGEe+3Bv20DBtn5T+bfYlxEmjezF3KI/x3 K4liNI+SiqPkHboUrKDMO6ObK9SJVh4WFyIJtStntDilIaOPTL3joInqrCdW2geQKxwZ 9z4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=m1hynBAGxvCrPbx+3JiNpNPZVWgxmUTXS4GFzWkSemo=; b=1Ja9ArVLPgWl/PjSEw6jHoQMY28YMBiObB7aophFQPyVEfT2ujPqcq+I0HwFLG+LNt +XvmJNvdkz2lAznhcMuWl5f2CjiHgwr7em8fsa5yeMMzn81EoX32+MM/BO8A5s3lyGFV ROIaVG+KqiBN0LZgQh3VHct1TdLjweBodq2zrV+XCvq/db8Zj0woWkjJqfjp8/MZnptS +bU4H+svP17wAgTPOvxF6Nhlst7HY1Sv2L9NFbslBewCtYDHRWyfj8nySfPHqzeJ54Pc SIf/KYMrW0vYah06NYicuo6vWhxrEVdVz9lgg1ffexOK4fTyqFIJKPUmJdEAsCTFlOIZ hOnA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f2-v6si15653076pgq.444.2018.05.23.12.09.13; Wed, 23 May 2018 12:09:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934118AbeEWTIn (ORCPT + 99 others); Wed, 23 May 2018 15:08:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:57665 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933928AbeEWTIk (ORCPT ); Wed, 23 May 2018 15:08:40 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 5EA17ACC6; Wed, 23 May 2018 19:08:39 +0000 (UTC) Date: Wed, 23 May 2018 11:52:13 -0700 From: Davidlohr Bueso To: Linus Torvalds Cc: Thomas Graf , Herbert Xu , Andrew Morton , Manfred Spraul , guillaume.knispel@supersonicimagine.com, Linux API , Linux Kernel Mailing List Subject: Re: semantics of rhashtable and sysvipc Message-ID: <20180523185213.oagftojqlh4rexa6@linux-n805> References: <20180523172500.anfvmjtumww65ief@linux-n805> <20180523183103.cdgv4slom62y56wi@linux-n805> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170421 (1.8.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 May 2018, Linus Torvalds wrote: >On Wed, May 23, 2018 at 11:47 AM Davidlohr Bueso wrote: > >> Note that even if the allocation was guaranteed, there are still param >validations >> and rhashtable_init() can return -EINVAL. > >So? > >It's not going to happen, because you're not going to give garbage >parameters. Maybe EINVAL could be replaced with WARN_ON(). That would grab the programmer's attention. > >Why would you add a BUG_ON() for something that cannot happen? You might as >well sprinkle them randomly in every damn place. Not suggesting this. Before I started the thread, I was actually thinking of ipc using ENOMEM only for rhashtable_init() filure considering the EINVAL case will never happen. > >And even if somebody screws up the parameters because they are being >stupid, then SO WHAT? rhashtable_init() won't initialize the pointers, and >we'll get a NULL pointer dereference. > >And hey, we'll probably get it later during boot, once the system is >actually up and running, and that NULL pointer dereference might even get >logged in the system logs now because the machine booted successfully, and >mnaybe it will even get sent to a distro and debugged. > >So at what point was there _any_ advantage in doing a BUG_ON() for a crazy >case? For the record, I'm not arguing in favor of BUG_ON().