On Wed, Jan 31, 2024 at 10:10:26AM -0500, Kent Overstreet wrote: > On Wed, Jan 31, 2024 at 05:52:11PM +0300, Dan Carpenter wrote: > > Hello Kent Overstreet, > > > > The patch 1c6fdbd8f246: "bcachefs: Initial commit" from Mar 16, 2017 > > (linux-next), leads to the following Smatch static checker warning: > > > > fs/bcachefs/btree_io.c:1672 bch2_btree_node_read() potential NULL > > container_of 'bio' > > fs/bcachefs/btree_io.c:2165 __bch2_btree_node_write() potential NULL > > container_of 'bio_alloc_bioset()' > > fs/bcachefs/ec.c:734 ec_block_io() potential NULL container_of > > 'bio_alloc_bioset()' > > fs/bcachefs/fs-io-buffered.c:489 bch2_writepage_io_alloc() potential NULL > > container_of 'bio_alloc_bioset()' > > fs/bcachefs/fs-io.c:81 bch2_inode_flush_nocow_writes_async() potential NULL > > container_of 'bio_alloc_bioset()' > > fs/bcachefs/io_write.c:407 bch2_submit_wbio_replicas() potential NULL > > container_of 'bio_alloc_clone()' > > fs/bcachefs/fs-io-direct.c:622 bch2_direct_write() potential NULL > > container_of 'bio' > > bio_alloc_bioset() is mempool backed and can't return NULL
There are three return NULL statements in bio_alloc_bioset() and the comments say it returns NULL on failure... But it's simple enough for to delete these from the Smatch cross function DB. regards, dan carpenter --- a/smatch_data/db/kernel.delete.return_states +++ b/smatch_data/db/kernel.delete.return_states @@ -12,3 +12,4 @@ scmi_raw_message_dequeue 0 __hci_cmd_sync_sk 0 regmap_read (-22) regmap_read (-4095)-(-1) +bio_alloc_bioset 0
