Skip to contentSkip to conversation

possible NULL pointer usage

DISCUSSION Cyrill Gorcunov 1 participant 1 message Apr 7, 2007

lore
Share & tools
lore
#0 lore raw

Hi,

from the function fs/udf/inode.c:udf_fill_inode -

	...

	UDF_I_DATA(inode) = kmalloc(inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry), GFP_KERNEL);
	memcpy(UDF_I_DATA(inode), bh->b_data + sizeof(struct extendedFileEntry), inode->i_sb->s_blocksize - sizeof(struct extendedFileEntry));

	...

so that can lead to NULL pointer usage. udf_fill_inode() declared as 'void' and the question I have is: what is the best solution to deal with a situation if kmalloc failed? May be just mark the node as bad by calling make_bad_inode() and return from the function?

Cyrill