From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 53F3172 for ; Mon, 26 Jul 2021 21:54:02 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 6C74D22072; Mon, 26 Jul 2021 21:53:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1627336435; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X9Eax8tO7kdHBAqOfn6Jrz1j5wL7j+3tjavdXKbnGYE=; b=Eyqa0wP4gUiudfKIMq+flyWLmUecCpQUdYazcVX08LjFPiHnflLtlldBiEP9PGRYw/W1yp le7M3Dd+tYOxIdqKriRBfgNEbW95T2hg0Ao2BioaauZJ1hdIT/iIV53S6SuglU/7jUv0Sa yobd2ZYUNGX2mKyd5ZlvUeejJ1f776A= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1627336435; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=X9Eax8tO7kdHBAqOfn6Jrz1j5wL7j+3tjavdXKbnGYE=; b=EVvJz6B1IRVu6JUqTRA2bmzqsr8dYFAX00V/C3l+yzz+XPlXw0+A+UGnfMQnJnbqpQ1qXg EC4YDzgtbAD0v6Ag== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C198713B58; Mon, 26 Jul 2021 21:53:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8JtAH/Au/2D9RQAAMHmgww (envelope-from ); Mon, 26 Jul 2021 21:53:52 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk X-Mailing-List: ksummit@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: "NeilBrown" To: "Linus Torvalds" Cc: "James Bottomley" , "Geert Uytterhoeven" , "Hannes Reinecke" , "Julia Lawall" , "Arnd Bergmann" , "Laurent Pinchart" , "Dan Carpenter" , ksummit@lists.linux.dev Subject: Re: Potential static analysis ideas In-reply-to: References: <20210723191023.GG25548@kadam>, , , <162717033769.3676.6942299974175827854@noble.neil.brown.name>, , , , , <633614dd-dd88-03f0-c463-d97036c58216@suse.de>, , <8ca1815230074c5ae31ec401ff533c0bf4baed92.camel@HansenPartnership.com>, Date: Tue, 27 Jul 2021 07:53:49 +1000 Message-id: <162733642991.4153.12959746307003856354@noble.neil.brown.name> On Tue, 27 Jul 2021, Linus Torvalds wrote: > > Anyway, gcc has this completely ass-backwards "nonnull" function > attribute, sadly it's pure garbage. It's not a "type of this pointer" > thing, it's a "this function does not take NULL as argument X" thing. Yeah, I found that annoying too. It seems to be purely about optimization. Marking a function parameter as "nonnull" means the compiler can optimize away any tests against NULL. > > We could relatively easily add a "__nonnull" type attribute (and > "__errptr") and parse it in sparse, but it would be _all_ over the sparse already parses __attribute__((safe)) which seems to mean something like __nonnull. It needs a bit of work to make it useful. > place, and without real compiler support it's probably not worth it > (people already don't run sparse all that much, and a lot of the > things sparse can warn about are too verbose to be be used in > practice). I'm not convinced that "real compiler support" is essential. checkpatch.pl does provide some value despite not being "real compiler support" and not being mandated. NeilBrown