Skip to contentSkip to conversation

New: Wrong xfer_funcs initialization in drivers/block/loop.c

Bug 668 Martin J. Bligh 1 participant 1 message May 6, 2003

lore
Share & tools
lore
#0 lore raw

http://bugme.osdl.org/show_bug.cgi?id=668

Summary: Wrong xfer_funcs initialization in drivers/block/loop.c
Kernel Version: 2.5.68 and 2.5.69 (at least)
Status: NEW
Severity: normal
Owner: [email protected]
Submitter: [email protected]

Distribution: SuSE Linux Professional 8.1
Software Environment: gcc 3.2.2 (but should be independant of that...)

Problem Description:
In drivers/block/loop.c loop_register_transfer always fails because all entries (instead of only first and seond) of the xfer_funcs array (in same file) are initialized to non-zero values (&xor_funcs).

Solution:
Change

struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = {
&none_funcs,
&xor_funcs
};

to

struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = {
	&none_funcs,
	&xor_funcs,
	0
};

in kernel version 2.4.20 there was only a comma after &xor_funcs:

struct loop_func_table *xfer_funcs[MAX_LO_CRYPT] = {
	&none_funcs,
	&xor_funcs,
};

which worked as well, but I guess it's better when the code doesn't depend on a single comma.