[PATCH] kernel: fix a compile error

Liu Yuan namei.unix at gmail.com
Wed May 8 05:04:32 PDT 2013


On 05/08/2013 05:32 PM, OGAWA Hirofumi wrote:
> Liu Yuan <namei.unix at gmail.com> writes:
> 
>> From: Liu Yuan <tailai.ly at taobao.com>
>>
>> make -C /lib/modules/`uname -r`/build/ M=`pwd` CONFIG_TUX3=m modules
>> make[1]: Entering directory `/home/yliu/linux-src'
>>   CC [M]  /home/yliu/tux3/user/kernel/dir.o
>> /home/yliu/tux3/user/kernel/dir.c: In function ‘tux_create_entry’:
>> /home/yliu/tux3/user/kernel/dir.c:148:4: error: ‘rec_len’ undeclared (first use in this function)
>> /home/yliu/tux3/user/kernel/dir.c:148:4: note: each undeclared identifier is reported only once for each function it appears in
>> /home/yliu/tux3/user/kernel/dir.c:130:52: error: unused variable ‘orec_len’ [-Werror=unused-variable]
>> cc1: all warnings being treated as errors
>> ...
> 
> Hm. I'm not sure what this meant. 1st warning says about undeclared
> variable. And 2nd one says about orec_len, but there is no orec_len in
> the source.
> 

oops, I pasted the wrong output. The error output is:

make -C /lib/modules/`uname -r`/build/ M=`pwd` CONFIG_TUX3=m modules
make[1]: Entering directory `/home/yliu/linux-src'
make[1]: warning: jobserver unavailable: using -j1.  Add `+' to parent make rule.
  CC [M]  /home/yliu/tux3/user/kernel/dir.o
/home/yliu/tux3/user/kernel/dir.c: In function ‘tux_create_entry’:
/home/yliu/tux3/user/kernel/dir.c:46:9: error: ‘name_len’ may be used uninitialized in this function [-Werror=uninitialized]
/home/yliu/tux3/user/kernel/dir.c:130:47: note: ‘name_len’ was declared here

>> -	unsigned reclen = TUX_REC_LEN(len), rec_len, name_len, offset;
>> +	unsigned reclen = TUX_REC_LEN(len), name_len = 0, rec_len, offset;
> 
> And this changes about name_len. BTW, what version of gcc is using?
> 

I am using 4.6.3.

Thanks,
Yuan




More information about the Tux3 mailing list