[AT&T, Rogers HTC One X, Telstra One XL] AlxMAX:
small kernel problem...

While trying to compile the kernel with gcc 4.8 toolchain, I've got this error:

In file included from drivers/usb/gadget/android.c:50:0:

drivers/usb/gadget/f_qdss.c: In function 'qdss_bind_config':

drivers/usb/gadget/f_qdss.c:586:38: warning: argument to 'sizeof' in 'strncmp' call is the same expression as the second source; did you mean to provide an explicit length? [-Wsizeof-pointer-memaccess]

error, forbidden warning: f_qdss.c:586

I have looked into the code and I have noticed these lines (starting with the line 586):

if( !strncmp( name, ch->name, sizeof(ch->name) ) ) {
found = 1;
break;
}

Further investigation has shown both name and ch->name were of type const char *. The only reason to use strncmp is to prevent the comparison from looking beyond any of the string end in case they are not 0 terminated. My questions are:

Is it really necessary to use sizeof? In my opinion, it is missused in this case.

Is the usage of strncmp justified at all? Can't strcmp be used?

I have tried to use gcc 4.6 instead, but this time I've got an error in one of the prima wlan files:

WARNING: vmlinux.o(.text+0x5889cc): Section mismatch in reference from the function wcnss_ready_probe() to the function .init.text:hdd_module_init()

The function wcnss_ready_probe() references

the function __init hdd_module_init().

This is often because wcnss_ready_probe lacks a __init

annotation or the annotation of hdd_module_init is wrong.

To build the kernel despite the mismatches, build with:

'make CONFIG_NO_ERROR_ON_MISMATCH=y'

(NOTE: This is not recommended)

This one is produced by the way the function wcnss_ready_probe (line 4115 in drivers/staging/prima/CORE/HDD/src/wlan_hdd_main.c) and the variable wcnss_ready are declared. As far as I could understand, the function needs an __init after int and the variable needs an __initdata before the equal sign. Something like this:

static int [b]__init[/b]
wcnss_ready_probe(struct platform_device *pdev)
{
return hdd_module_init();
}

static struct platform_driver wcnss_ready [b]__initdata[/b] = {
.driver = {
.name = "wcnss_ready",
.owner = THIS_MODULE,
},
.probe = wcnss_ready_probe,
};

With these modifications, both toolchains seem to build without any error. My questions is if the kernel might lock because of these 2 modifications.

Edit: Forgot to mention this error when building the kernel using gcc 4.8 toolchain:

drivers/gpu/msm/adreno.c: In function 'adreno_iommu_setstate':

drivers/gpu/msm/adreno.c:795:1: warning: the frame size of 1032 bytes is larger than 1024 bytes [-Wframe-larger-than=]

error, forbidden warning: adreno.c:795

It can be silenced with some lines added at the beginning of drivers/gpu/msm/Makefile:

GCC_VERSION := $(shell $(CONFIG_SHELL) $(PWD)/scripts/gcc-version.sh $(CROSS_COMPILE)gcc)
ifeq ($(GCC_VERSION),0404)
CFLAGS_REMOVE_adreno.o = -Wframe-larger-than=${CONFIG_FRAME_WARN}
endif
ifeq ($(GCC_VERSION),0406)
CFLAGS_REMOVE_adreno.o = -Wframe-larger-than=${CONFIG_FRAME_WARN}
endif
ifeq ($(GCC_VERSION),0407)
CFLAGS_REMOVE_adreno.o = -Wframe-larger-than=${CONFIG_FRAME_WARN}
endif
ifeq ($(GCC_VERSION),0408)
CFLAGS_REMOVE_adreno.o = -Wframe-larger-than=${CONFIG_FRAME_WARN}
endif

The fix eliminates the warning, but it doesn't eliminate the cause and I don't know the impact of adreno_iommu_setstate having a larger frame size. Examining the code in drivers/gpu/msm/adreno.c at line 644 (this is where the function implementation begins) I have noticed this declaration: unsigned int link[250]; which occupies a lot of space in the stack. Couldn't we declare unsigned int *link and use kmalloc?