- 27 Oct, 2014 5 commits
-
-
Tapasweni Pathak authored
Use kstrdup when the goal of an allocation is copy a string into the allocated region. Patch found by coccicheck. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ebru Akagunduz authored
This patch fixes "cast to restricted __be32" sparse warning. remove temporary value assignment and use inplace __be32 conversion for ntohl function which is can get big endian format Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Vaishali Thakkar authored
This patch uses kasprintf which combines kmalloc and sprintf. kasprintf also takes care of the size calculation. This is done using Coccinelle. Semantic patch used is as follows: @@ expression a,flag; expression list args; statement S; @@ a = - \(kmalloc\|kzalloc\)(...,flag) + kasprintf (flag,args) <... when != a if (a == NULL || ...) S ...> - sprintf(a,args); Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Somya Anand authored
'struct timeval t' is used to return remaining time in milliseconds. 32-bit systems using 'struct timeval' will break in the year 2038, so we have to replace that code with more appropriate types. This patch changes the android driver to use ktime_t. Signed-off-by: Somya Anand <somyaanand214@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Somya Anand authored
'struct timeval last' is used for recording last time interrupt. 'struct timeval now' is used for calculating elapsed time. 32-bit systems using 'struct timeval' will break in the year 2038, so we have to replace that code with more appropriate types. This patch changes the comedi driver to use ktime_t. Since this code doesn't communicate the time values to the outside (user space, file system, network).Thus ktime_get() is a better than using do_gettimeofday() as it uses monotonic clock. ktime_to_us() returns an 's64', and using the '%' operator on that requires doing a 64-bit division which needs an expensive library function call the specific value of usec_current does not actually matter although it might matter that it's not always the same which will start with the offset from the lower 32 bit of the microsecond. Therefore: devpriv->usec_current = (ktime_to_us(devpriv->last) % USEC_PER_SEC) % devpriv->usec_period; is replaced by devpriv->usec_current = ((u32)ktime_to_us(devpriv->last)) % devpriv->usec_period; Signed-off-by: Somya Anand <somyaanand214@gmail.com> Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 23 Oct, 2014 25 commits
-
-
Jiayi Ye authored
If a variable has value 0, then there is no point in combining it with other things with |, as for any x, 0 | x is just x. The following semantic patch finds this problem. @@ expression x,e,e1; statement S; @@ if (x == 0) { <... when != x = e1 when != while(...) S when != for(...;...;...) S ( * x |= e | * x | e ) ...> } Signed-off-by: Jiayi Ye <yejiayily@gmail.com> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Ebru Akagunduz authored
skb->protocol variable type is __be16 and in if condition it is comparing with ETH_P_80211_RAW constant variable which is not __be16 type. Using be16_to_cpu() function, value of skb->protocol converted native processor format. This bug was found by sparse. Signed-off-by: Ebru Akagunduz <ebru.akagunduz@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aybuke Ozdemir authored
This patch focuses on fixing the following warning generated by checkpatch.pl for the file tcm825x.c: WARNİNG: min() should probably be min_t(u32, tgt_xclk, TCM825X_XCLK_MAX) The changes were applied using the following coccinelle rule: @@ expression e1, e2; typedef u32; @@ -tgt_xclk = min(e1, (u32)e2); +tgt_xclk = min_t(u32, e1, e2); Signed-off-by: Aybuke Ozdemir <aybuke.147@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
This patch was generated by the following semantic patch: // <smpl> @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // </smpl> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
Removed the unnecessary else if condition as it has only one comment inside it and do not have an FIXME or TODO comment near to it too. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
This patch was generated by the following semantic patch: // <smpl> @@ expression E; @@ - if (E != NULL) { kfree(E); } + kfree(E); @@ expression E; @@ - if (E != NULL) { kfree(E); E = NULL; } + kfree(E); + E = NULL; // </smpl> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
The function tv2int is used to convert timeval to int. 32-bit systems using 'struct timeval' will break in the year 2038, so we have to replace that code with more appropriate types. This patch changes the lirc_imon.c file of media: lirc driver. tv2int function is static and not used anywhere in this file too, so it is removed. I also build tested it. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
high is a bool type variable. bool variable should be assigned true, false not 1 or 0. This patch assigns high to true, replacing 1. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiayi Ye authored
Variable whose value is initialized but never used is unnecessary. The following Coccinelle semantic patch removed the unused variable. @e@ identifier i; position p; type T; @@ extern T i@p; @@ type T; identifier i; constant C; position p != e.p; @@ - T i@p; <+... when != i - i = C; ...+> Signed-off-by: Jiayi Ye <yejiayily@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
The sematic patch used for this is: // <smpl> @@ identifier i; constant c; @@ return - ( \(i\|-i\|i(...)\|c\) - ) ; // </smpl> Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Julia Lawall <julia.lawall@lip6.fr> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
Replaced calls to kzalloc followed by memcpy with a single call to kmemdup. Patch found using coccicheck. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tapasweni Pathak authored
Casting rhe return value which is a void pointer is redundant. The conversion from void pointer to any other pointer type is guaranteed by the C programming language, as mentioned in Documentation/CodingStyle, Chap 14. Removed the cast on kzalloc return value. Signed-off-by: Tapasweni Pathak <tapaswenipathak@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiayi Ye authored
This patch fixes following checkpatch.pl warning: WARNING: msleep < 20ms can sleep for up to 20ms; see Documentation/timers/timers-howto.txt Signed-off-by: Jiayi Ye <yejiayily@gmail.comi> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes the following checkpatch errors: ERROR: "foo * bar" should be "foo *bar" 951: FILE: drivers/staging/lustre/lustre/llite/namei.c:951: static void ll_get_child_fid(struct inode * dir, struct qstr *name, 1193: FILE: drivers/staging/lustre/lustre/llite/namei.c:1193: static int ll_unlink(struct inode * dir, struct dentry *dentry) Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes the following checkpatch error:j ERROR: switch and case should be at the same indent 105: FILE: drivers/staging/lustre/lustre/libcfs/fail.c:105: Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes the following checkpatch.pl error: "Macros with complex values should be enclosed in parentheses." Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes the following checkpatch.pl errors: ERROR: do not use C99 // comments 538: FILE: drivers/staging/lustre/lustre/llite/rw26.c:538: // .orig_aops.readpages = ll_readpages, 816: FILE: drivers/staging/lustre/lustre/llite/lproc_llite.c:816: //{ "mntpt_path", ll_rd_path, 0, 0 }, 826: FILE: drivers/staging/lustre/lustre/llite/lproc_llite.c:826: //{ "filegroups", lprocfs_rd_filegroups, 0, 0 }, Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes the following checkpatch.pl warnings: WARNING: Prefer kcalloc over kzalloc with multiply 166: FILE: drivers/staging/lustre/lustre/llite/dir.c:166: page_pool = kzalloc(sizeof(page) * max_pages, GFP_NOFS); 796: FILE: drivers/staging/lustre/lustre/llite/lloop.c:796: loop_dev = kzalloc(max_loop * sizeof(*loop_dev), GFP_KERNEL); 800: FILE: drivers/staging/lustre/lustre/llite/lloop.c:800: disks = kzalloc(max_loop * sizeof(*disks), GFP_KERNEL); Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Tina Ruchandani authored
This patch fixes misc. spacing errors reported by checkpatch.pl for lustre/llite/file.c Signed-off-by: Tina Ruchandani <ruchandani.tina@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jiayi Ye authored
The GOTO macro is not standard in Linux. The following Coccinelle semantic patch was used to expand the GOTO macro. @@ identifier lbl; identifier rc; constant c; @@ - GOTO(lbl,\(rc\|c\)); + goto lbl; @@ identifier lbl; expression rc; @@ - GOTO(lbl,rc); + rc; + goto lbl; Signed-off-by: Jiayi Ye <yejiayily@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Vaishali Thakkar authored
The linux kernel coding style guidelines suggest not using typedefs for structure types. This patch gets rid of the typedef for ldlm_ns_hash_def_t. Also, the name of the struct is changed to drop the _t, to make the name look less typedef-like. This is done using Coccinelle. Semantic patch used to detect this case is as follows: @tn1@ type td; @@ typedef struct { ... } td; @script:python tf@ td << tn1.td; tdres; @@ coccinelle.tdres = td; @@ type tn1.td; identifier tf.tdres; @@ -typedef struct + tdres { ... } -td ; @@ type tn1.td; identifier tf.tdres; @@ -td + struct tdres Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Vaishali Thakkar authored
This patch makes functions proc_lnet_routes, proc_lnet_routers, proc_lnet_peers and proc_lnet_nis static in file router_proc.c as they are used only in this file. This problem is detected by sparse. Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com> Reviewed-by: Josh Triplett <josh@joshtriplett.org> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Roberta Dobrescu authored
This patch adds the missing IIO modifiers in event_is_known function and iio_modifier_names vector. Additionally, it removes duplicate name entries of IIO_MOD_LIGHT_BOTH and IIO_MOD_LIGHT_IR in iio_modifier_names. Signed-off-by: Roberta Dobrescu <roberta.dobrescu@gmail.com> Reviewed-by: Daniel Baluta <daniel.baluta@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Somya Anand authored
The output written by dgnc_sniff_nowait_nolock() is never used anywhere since commit 35cf9045 ("staging: dgnc: removes proc code") deleted the code that used to copy it to user space. dgnc_sniff_nowait_nolock() uses 'timeval' to create header timestamps for the data dump. 32-bit systems using 'struct timeval' will break in the year 2038, This patch removes dgnc_sniff_nowait_nolock() and all ch_sniff_* members of struct channel_t defined in "dgnc_driver.h". It also removes their usage from the driver files and hence y2038 issue is also resolved. Signed-off-by: Somya Anand <somyaanand214@gmail.com> Reviewed-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aya Mahfouz authored
This patch fixes the following warning generated by checkpatch.pl for the file wcmd.c WARNING: printk() should include KERN_ facility level printk was replaced by netdev_err since providing printk with the facility level KERN_ERR generated the printing priority warning. Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
- 20 Oct, 2014 10 commits
-
-
Eric Rost authored
Reorganizes file to remove #defines from middle of functions. Also removes #if'd loop declarations and adds ternary if driven loops. Signed-off-by: Eric Rost <eric.rost@mybabylon.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Eric Rost authored
Pretties up multiline #defines and many other whitespace issues Signed-off-by: Eric Rost <eric.rost@mybabylon.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Greg Kroah-Hartman authored
binder.h isn't needed to just include a uapi file and set a single define, so move it into binder.c to save a few lines of code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Greg Kroah-Hartman authored
add types.h to .h file to pass the checker scripts, and provide a proper uapi .h file. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Greg Kroah-Hartman authored
The Android binder code has been "stable" for many years now. No matter what comes in the future, we are going to have to support this API, so might as well move it to the "real" part of the kernel as there's no real work that needs to be done to the existing code. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Jeff Kirsher authored
The Beceem WiMAX driver was barely function in its current state and was non-functional on 64 bit systems. Based on repeated statements from Greg KH that he wanted the driver removed, I am removing the driver. CC: Matthias Beyer <mail@beyermatthias.de> CC: Kevin McKinney <klmckinney1@gmail.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aya Mahfouz authored
This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); After applying the rule, some referencing operations were adjusted manually to avoid a gcc compilation warning. According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. A check was made on the following datastructures: - vnt_mic_hdr - tagS802_11Header - tagSEthernetHeader - vnt_rts_g - ieee80211_rts - vnt_private To maintain that the array abyCurrentNetAddr in vnt_private is aligned, it was placed before the boolean bLinkPass in the struct definition. The definition can be found in device.h. A couple of variables were packed in holes detected by pahole. Output of pahole when running it on rxtx.o after the changes: truct tagSEthernetHeader { unsigned char abyDstAddr[6]; /* 0 6 */ unsigned char abySrcAddr[6]; /* 6 6 */ short unsigned int wType; /* 12 2 */ /* size: 14, cachelines: 1, members: 3 */ /* last cacheline: 14 bytes */ }; struct tagS802_11Header { short unsigned int wFrameCtl; /* 0 2 */ short unsigned int wDurationID; /* 2 2 */ unsigned char abyAddr1[6]; /* 4 6 */ unsigned char abyAddr2[6]; /* 10 6 */ unsigned char abyAddr3[6]; /* 16 6 */ short unsigned int wSeqCtl; /* 22 2 */ unsigned char abyAddr4[6]; /* 24 6 */ /* size: 30, cachelines: 1, members: 7 */ /* last cacheline: 30 bytes */ }; struct ieee80211_rts { __le16 frame_control; /* 0 2 */ __le16 duration; /* 2 2 */ u8 ra[6]; /* 4 6 */ u8 ta[6]; /* 10 6 */ /* size: 16, cachelines: 1, members: 4 */ /* last cacheline: 16 bytes */ }; struct vnt_private { struct pci_dev * pcid; /* 0 4 */ struct net_device * dev; /* 4 4 */ dma_addr_t pool_dma; /* 8 4 */ dma_addr_t rd0_pool_dma; /* 12 4 */ dma_addr_t rd1_pool_dma; /* 16 4 */ dma_addr_t td0_pool_dma; /* 20 4 */ dma_addr_t td1_pool_dma; /* 24 4 */ dma_addr_t tx_bufs_dma0; /* 28 4 */ dma_addr_t tx_bufs_dma1; /* 32 4 */ dma_addr_t tx_beacon_dma; /* 36 4 */ unsigned char * tx0_bufs; /* 40 4 */ unsigned char * tx1_bufs; /* 44 4 */ unsigned char * tx_beacon_bufs; /* 48 4 */ CHIP_TYPE chip_id; /* 52 4 */ void * PortOffset; /* 56 4 */ long unsigned int dwIsr; /* 60 4 */ /*--- cacheline 1 boundary (64 bytes) ---*/ u32 memaddr; /* 64 4 */ u32 ioaddr; /* 68 4 */ u32 io_size; /* 72 4 */ unsigned char byRevId; /* 76 1 */ unsigned char byRxMode; /* 77 1 */ short unsigned int SubSystemID; /* 78 2 */ short unsigned int SubVendorID; /* 80 2 */ spinlock_t lock; /* 82 2 */ int nTxQueues; /* 84 4 */ volatile int iTDUsed; /* 88 8 */ volatile PSTxDesc apCurrTD; /* 96 8 */ volatile PSTxDesc apTailTD; /* 104 8 */ volatile PSTxDesc apTD0Rings; /* 112 4 */ volatile PSTxDesc apTD1Rings; /* 116 4 */ volatile PSRxDesc aRD0Ring; /* 120 4 */ volatile PSRxDesc aRD1Ring; /* 124 4 */ /*--- cacheline 2 boundary (128 bytes) ---*/ volatile PSRxDesc pCurrRD; /* 128 8 */ SCache sDupRxCache; /* 136 44 */ SDeFragControlBlock sRxDFCB[64]; /* 180 2048 */ /*--- cacheline 34 boundary (2176 bytes) was 52 bytes ago ---*/ unsigned int cbDFCB; /* 2228 4 */ unsigned int cbFreeDFCB; /* 2232 4 */ unsigned int uCurrentDFCBIdx; /* 2236 4 */ /*--- cacheline 35 boundary (2240 bytes) ---*/ OPTIONS sOpts; /* 2240 52 */ u32 flags; /* 2292 4 */ u32 rx_buf_sz; /* 2296 4 */ int multicast_limit; /* 2300 4 */ /*--- cacheline 36 boundary (2304 bytes) ---*/ pid_t MLMEThr_pid; /* 2304 4 */ struct completion notify; /* 2308 16 */ struct semaphore mlme_semaphore; /* 2324 16 */ u32 rx_bytes; /* 2340 4 */ unsigned char byLocalID; /* 2344 1 */ unsigned char byRFType; /* 2345 1 */ unsigned char byMaxPwrLevel; /* 2346 1 */ unsigned char byZoneType; /* 2347 1 */ bool bZoneRegExist; /* 2348 1 */ unsigned char byOriginalZonetype; /* 2349 1 */ unsigned char abyMacContext[384]; /* 2350 384 */ /*--- cacheline 42 boundary (2688 bytes) was 46 bytes ago ---*/ unsigned char abyCurrentNetAddr[6]; /* 2734 6 */ bool bLinkPass; /* 2740 1 */ /* XXX 3 bytes hole, try to pack */ SStatCounter scStatistic; /* 2744 776 */ /*--- cacheline 55 boundary (3520 bytes) ---*/ SDot11Counters s802_11Counter; /* 3520 172 */ /*--- cacheline 57 boundary (3648 bytes) was 44 bytes ago ---*/ PSMgmtObject pMgmt; /* 3692 4 */ SMgmtObject sMgmtObj; /* 3696 95840 */ /*--- cacheline 1555 boundary (99520 bytes) was 16 bytes ago ---*/ /* Bitfield combined with previous fields */ unsigned int uCurrRSSI; /* 0 4 */ unsigned char byCurrSQ; /* 0 1 */ long unsigned int dwTxAntennaSel; /* 0 4 */ long unsigned int dwRxAntennaSel; /* 0 4 */ unsigned char byAntennaCount; /* 0 1 */ unsigned char byRxAntennaMode; /* 0 1 */ unsigned char byTxAntennaMode; /* 0 1 */ bool bTxRxAntInv; /* 0 1 */ unsigned char * pbyTmpBuff; /* 0 4 */ unsigned int uSIFS; /* 0 4 */ unsigned int uDIFS; /* 0 4 */ unsigned int uEIFS; /* 0 4 */ unsigned int uSlot; /* 0 4 */ unsigned int uCwMin; /* 0 4 */ unsigned int uCwMax; /* 0 4 */ unsigned char bySIFS; /* 0 1 */ unsigned char byDIFS; /* 0 1 */ unsigned char byEIFS; /* 0 1 */ unsigned char bySlot; /* 0 1 */ unsigned char byCWMaxMin; /* 0 1 */ CARD_PHY_TYPE eCurrentPHYType; /* 0 4 */ VIA_BB_TYPE byBBType; /* 0 4 */ VIA_PKT_TYPE byPacketType; /* 0 4 */ short unsigned int wBasicRate; /* 0 2 */ unsigned char byACKRate; /* 0 1 */ unsigned char byTopOFDMBasicRate; /* 0 1 */ unsigned char byTopCCKBasicRate; /* 0 1 */ unsigned char byMinChannel; /* 0 1 */ unsigned char byMaxChannel; /* 0 1 */ unsigned int uConnectionRate; /* 0 4 */ unsigned char byPreambleType; /* 0 1 */ unsigned char byShortPreamble; /* 0 1 */ short unsigned int wCurrentRate; /* 0 2 */ short unsigned int wRTSThreshold; /* 0 2 */ short unsigned int wFragmentationThreshold; /* 0 2 */ unsigned char byShortRetryLimit; /* 0 1 */ unsigned char byLongRetryLimit; /* 0 1 */ enum nl80211_iftype op_mode; /* 0 4 */ unsigned char byOpMode; /* 0 1 */ bool bBSSIDFilter; /* 0 1 */ short unsigned int wMaxTransmitMSDULifetime; /* 0 2 */ unsigned char abyBSSID[6]; /* 0 6 */ unsigned char abyDesireBSSID[6]; /* 0 6 */ short unsigned int wACKDuration; /* 0 2 */ short unsigned int wRTSTransmitLen; /* 0 2 */ unsigned char byRTSServiceField; /* 0 1 */ unsigned char byRTSSignalField; /* 0 1 */ long unsigned int dwMaxReceiveLifetime; /* 0 4 */ bool bEncryptionEnable; /* 0 1 */ bool bLongHeader; /* 0 1 */ bool bShortSlotTime; /* 0 1 */ bool bProtectMode; /* 0 1 */ bool bNonERPPresent; /* 0 1 */ bool bBarkerPreambleMd; /* 0 1 */ unsigned char byERPFlag; /* 0 1 */ short unsigned int wUseProtectCntDown; /* 0 2 */ bool bRadioControlOff; /* 0 1 */ bool bRadioOff; /* 0 1 */ bool bEnablePSMode; /* 0 1 */ short unsigned int wListenInterval; /* 0 2 */ bool bPWBitOn; /* 0 1 */ WMAC_POWER_MODE ePSMode; /* 0 4 */ unsigned char byRadioCtl; /* 0 1 */ unsigned char byGPIO; /* 0 1 */ bool bHWRadioOff; /* 0 1 */ bool bPrvActive4RadioOFF; /* 0 1 */ bool bGPIOBlockRead; /* 0 1 */ short unsigned int wSeqCounter; /* 0 2 */ short unsigned int wBCNBufLen; /* 0 2 */ bool bBeaconBufReady; /* 0 1 */ bool bBeaconSent; /* 0 1 */ bool bIsBeaconBufReadySet; /* 0 1 */ unsigned int cbBeaconBufReadySetCnt; /* 0 4 */ bool bFixRate; /* 0 1 */ unsigned char byCurrentCh; /* 0 1 */ unsigned int uScanTime; /* 0 4 */ CMD_STATE eCommandState; /* 0 4 */ CMD_CODE eCommand; /* 0 4 */ bool bBeaconTx; /* 0 1 */ bool bStopBeacon; /* 0 1 */ bool bStopDataPkt; /* 0 1 */ bool bStopTx0Pkt; /* 0 1 */ unsigned int uAutoReConnectTime; /* 0 4 */ CMD_ITEM eCmdQueue[32]; /* 0 1408 */ unsigned int uCmdDequeueIdx; /* 0 4 */ unsigned int uCmdEnqueueIdx; /* 0 4 */ unsigned int cbFreeCmdQueue; /* 0 4 */ bool bCmdRunning; /* 0 1 */ bool bCmdClear; /* 0 1 */ bool bRoaming; /* 0 1 */ unsigned char abyIPAddr[4]; /* 0 4 */ long unsigned int ulTxPower; /* 0 4 */ NDIS_802_11_WEP_STATUS eEncryptionStatus; /* 0 4 */ bool bTransmitKey; /* 0 1 */ NDIS_802_11_WEP_STATUS eOldEncryptionStatus; /* 0 4 */ SKeyManagement sKey; /* 0 3784 */ long unsigned int dwIVCounter; /* 0 4 */ u64 qwPacketNumber; /* 0 8 */ unsigned int uCurrentWEPMode; /* 0 4 */ RC4Ext SBox; /* 0 264 */ unsigned char abyPRNG[35]; /* 0 35 */ unsigned char byKeyIndex; /* 0 1 */ unsigned int uKeyLength; /* 0 4 */ unsigned char abyKey[29]; /* 0 29 */ bool bAES; /* 0 1 */ unsigned char byCntMeasure; /* 0 1 */ unsigned int uAssocCount; /* 0 4 */ bool bMoreData; /* 0 1 */ bool bGrpAckPolicy; /* 0 1 */ bool bAssocInfoSet; /* 0 1 */ unsigned char byAutoFBCtrl; /* 0 1 */ bool bTxMICFail; /* 0 1 */ bool bRxMICFail; /* 0 1 */ unsigned int uRATEIdx; /* 0 4 */ bool bUpdateBBVGA; /* 0 1 */ unsigned int uBBVGADiffCount; /* 0 4 */ unsigned char byBBVGANew; /* 0 1 */ unsigned char byBBVGACurrent; /* 0 1 */ unsigned char abyBBVGA[4]; /* 0 4 */ long int ldBmThreshold[4]; /* 0 16 */ unsigned char byBBPreEDRSSI; /* 0 1 */ unsigned char byBBPreEDIndex; /* 0 1 */ bool bRadioCmd; /* 0 1 */ long unsigned int dwDiagRefCount; /* 0 4 */ unsigned char byFOETuning; /* 0 1 */ unsigned char byAutoPwrTunning; /* 0 1 */ short int sPSetPointCCK; /* 0 2 */ short int sPSetPointOFDMG; /* 0 2 */ short int sPSetPointOFDMA; /* 0 2 */ long int lPFormulaOffset; /* 0 4 */ short int sPThreshold; /* 0 2 */ char cAdjustStep; /* 0 1 */ char cMinTxAGC; /* 0 1 */ unsigned char byCCKPwr; /* 0 1 */ unsigned char byOFDMPwrG; /* 0 1 */ unsigned char byCurPwr; /* 0 1 */ char byCurPwrdBm; /* 0 1 */ unsigned char abyCCKPwrTbl[15]; /* 0 15 */ unsigned char abyOFDMPwrTbl[57]; /* 0 57 */ char abyCCKDefaultPwr[15]; /* 0 15 */ char abyOFDMDefaultPwr[57]; /* 0 57 */ char abyRegPwr[57]; /* 0 57 */ char abyLocalPwr[57]; /* 0 57 */ unsigned char byBBCR4d; /* 0 1 */ unsigned char byBBCRc9; /* 0 1 */ unsigned char byBBCR88; /* 0 1 */ unsigned char byBBCR09; /* 0 1 */ struct timer_list sTimerCommand; /* 0 52 */ struct timer_list sTimerTxData; /* 0 52 */ long unsigned int nTxDataTimeCout; /* 0 4 */ bool fTxDataInSleep; /* 0 1 */ bool IsTxDataTrigger; /* 0 1 */ bool fWPA_Authened; /* 0 1 */ unsigned char byReAssocCount; /* 0 1 */ unsigned char byLinkWaitCount; /* 0 1 */ unsigned char abyNodeName[17]; /* 0 17 */ bool bDiversityRegCtlON; /* 0 1 */ bool bDiversityEnable; /* 0 1 */ long unsigned int ulDiversityNValue; /* 0 4 */ long unsigned int ulDiversityMValue; /* 0 4 */ unsigned char byTMax; /* 0 1 */ unsigned char byTMax2; /* 0 1 */ unsigned char byTMax3; /* 0 1 */ long unsigned int ulSQ3TH; /* 0 4 */ long unsigned int uDiversityCnt; /* 0 4 */ unsigned char byAntennaState; /* 0 1 */ long unsigned int ulRatio_State0; /* 0 4 */ long unsigned int ulRatio_State1; /* 0 4 */ struct timer_list TimerSQ3Tmax1; /* 0 52 */ struct timer_list TimerSQ3Tmax2; /* 0 52 */ struct timer_list TimerSQ3Tmax3; /* 0 52 */ long unsigned int uNumSQ3[12]; /* 0 48 */ short unsigned int wAntDiversityMaxRate; /* 0 2 */ SEthernetHeader sTxEthHeader; /* 0 14 */ SEthernetHeader sRxEthHeader; /* 0 14 */ unsigned char abyBroadcastAddr[6]; /* 0 6 */ unsigned char abySNAP_RFC1042[6]; /* 0 6 */ unsigned char abySNAP_Bridgetunnel[6]; /* 0 6 */ unsigned char abyEEPROM[256]; /* 0 256 */ SPMKID gsPMKID; /* 0 360 */ SPMKIDCandidateEvent gsPMKIDCandidate; /* 0 72 */ bool b11hEnable; /* 0 1 */ unsigned char abyCountryCode[3]; /* 0 3 */ unsigned int uNumOfMeasureEIDs; /* 0 4 */ PWLAN_IE_MEASURE_REQ pCurrMeasureEID; /* 0 4 */ bool bMeasureInProgress; /* 0 1 */ unsigned char byOrgChannel; /* 0 1 */ unsigned char byOrgRCR; /* 0 1 */ long unsigned int dwOrgMAR0; /* 0 4 */ long unsigned int dwOrgMAR4; /* 0 4 */ unsigned char byBasicMap; /* 0 1 */ unsigned char byCCAFraction; /* 0 1 */ unsigned char abyRPIs[8]; /* 0 8 */ long unsigned int dwRPIs[8]; /* 0 32 */ bool bChannelSwitch; /* 0 1 */ unsigned char byNewChannel; /* 0 1 */ unsigned char byChannelSwitchCount; /* 0 1 */ bool bQuietEnable; /* 0 1 */ bool bEnableFirstQuiet; /* 0 1 */ unsigned char byQuietStartCount; /* 0 1 */ unsigned int uQuietEnqueue; /* 0 4 */ long unsigned int dwCurrentQuietEndTime; /* 0 4 */ SQuietControl sQuiet[8]; /* 0 96 */ bool bCountryInfo5G; /* 0 1 */ bool bCountryInfo24G; /* 0 1 */ short unsigned int wBeaconInterval; /* 0 2 */ struct net_device * wpadev; /* 0 4 */ bool bWPADEVUp; /* 0 1 */ struct sk_buff * skb; /* 0 4 */ unsigned int bwextcount; /* 0 4 */ bool bWPASuppWextEnabled; /* 0 1 */ bool bEnableHostapd; /* 0 1 */ bool bEnable8021x; /* 0 1 */ bool bEnableHostWEP; /* 0 1 */ struct net_device * apdev; /* 0 4 */ int (*tx_80211)(struct sk_buff *, struct net_device *); /* 0 4 */ unsigned int uChannel; /* 0 4 */ bool bMACSuspend; /* 0 1 */ struct iw_statistics wstats; /* 0 32 */ bool bCommit; /* 0 1 */ /*--- cacheline 1672 boundary (107008 bytes) ---*/ /* size: 107008, cachelines: 1672, members: 279 */ /* sum members: 107005, holes: 1, sum holes: 3 */ /* padding: 41471 */ /* BRAIN FART ALERT! 107008 != 107005 + 3(holes), diff = 0 */ }; struct vnt_mic_hdr { u8 id; /* 0 1 */ u8 tx_priority; /* 1 1 */ u8 mic_addr2[6]; /* 2 6 */ u8 ccmp_pn[6]; /* 8 6 */ __be16 payload_len; /* 14 2 */ __be16 hlen; /* 16 2 */ __le16 frame_control; /* 18 2 */ u8 addr1[6]; /* 20 6 */ u8 addr2[6]; /* 26 6 */ u8 addr3[6]; /* 32 6 */ __le16 seq_ctrl; /* 38 2 */ u8 addr4[6]; /* 40 6 */ u16 packing; /* 46 2 */ /* size: 48, cachelines: 1, members: 13 */ /* last cacheline: 48 bytes */ }; struct vnt_rts_g { struct vnt_phy_field b; /* 0 4 */ struct vnt_phy_field a; /* 4 4 */ __le16 duration_ba; /* 8 2 */ __le16 duration_aa; /* 10 2 */ __le16 duration_bb; /* 12 2 */ u16 reserved; /* 14 2 */ struct ieee80211_rts data; /* 16 16 */ /* size: 32, cachelines: 1, members: 7 */ /* last cacheline: 32 bytes */ }; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aya Mahfouz authored
staging: vt6655: wmgr.c and wmgr.h: replace memcpy() by ether_addr_copy() using coccinelle and pack variable This patch focuses on fixing the following warning generated by checkpatch.pl for the file wmgr.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. To maintain that the array abyCurrBSSID in tagSMgmtObject is aligned, it was placed after the int uCurrChannel in the struct definition. This was done in wmgr.h Here is the output of pahole for the relevant datastructures: struct sockaddr { sa_family_t sa_family; /* 0 2 */ char sa_data[14]; /* 2 14 */ /* size: 16, cachelines: 1, members: 2 */ /* last cacheline: 16 bytes */ }; struct tagSMgmtObject { void * pAdapter; /* 0 4 */ unsigned char abyMACAddr[6]; /* 4 6 */ /* XXX 2 bytes hole, try to pack */ WMAC_CONFIG_MODE eConfigMode; /* 12 4 */ CARD_PHY_TYPE eCurrentPHYMode; /* 16 4 */ CARD_PHY_TYPE eConfigPHYMode; /* 20 4 */ WMAC_CURRENT_MODE eCurrMode; /* 24 4 */ WMAC_BSS_STATE eCurrState; /* 28 4 */ PKnownBSS pCurrBSS; /* 32 4 */ unsigned char byCSSGK; /* 36 1 */ unsigned char byCSSPK; /* 37 1 */ /* XXX 2 bytes hole, try to pack */ unsigned int uCurrChannel; /* 40 4 */ unsigned char abyCurrBSSID[6]; /* 44 6 */ unsigned char abyCurrSuppRates[19]; /* 50 19 */ /* --- cacheline 1 boundary (64 bytes) was 5 bytes ago --- */ unsigned char abyCurrExtSuppRates[19]; /* 69 19 */ unsigned char abyCurrSSID[35]; /* 88 35 */ /* XXX 1 byte hole, try to pack */ short unsigned int wCurrCapInfo; /* 124 2 */ short unsigned int wCurrAID; /* 126 2 */ /* --- cacheline 2 boundary (128 bytes) --- */ short unsigned int wCurrATIMWindow; /* 128 2 */ short unsigned int wCurrBeaconPeriod; /* 130 2 */ bool bIsDS; /* 132 1 */ unsigned char byERPContext; /* 133 1 */ /* XXX 2 bytes hole, try to pack */ CMD_STATE eCommandState; /* 136 4 */ unsigned int uScanChannel; /* 140 4 */ unsigned char abyDesireSSID[35]; /* 144 35 */ unsigned char abyDesireBSSID[6]; /* 179 6 */ /* XXX 1 byte hole, try to pack */ short unsigned int wIBSSBeaconPeriod; /* 186 2 */ short unsigned int wIBSSATIMWindow; /* 188 2 */ /* XXX 2 bytes hole, try to pack */ /* --- cacheline 3 boundary (192 bytes) --- */ unsigned int uIBSSChannel; /* 192 4 */ unsigned char abyIBSSSuppRates[19]; /* 196 19 */ unsigned char byAPBBType; /* 215 1 */ unsigned char abyWPAIE[64]; /* 216 64 */ /* --- cacheline 4 boundary (256 bytes) was 24 bytes ago --- */ short unsigned int wWPAIELen; /* 280 2 */ /* XXX 2 bytes hole, try to pack */ unsigned int uAssocCount; /* 284 4 */ bool bMoreData; /* 288 1 */ /* XXX 3 bytes hole, try to pack */ WMAC_SCAN_STATE eScanState; /* 292 4 */ WMAC_SCAN_TYPE eScanType; /* 296 4 */ unsigned int uScanStartCh; /* 300 4 */ unsigned int uScanEndCh; /* 304 4 */ short unsigned int wScanSteps; /* 308 2 */ /* XXX 2 bytes hole, try to pack */ unsigned int uScanBSSType; /* 312 4 */ unsigned char abyScanSSID[35]; /* 316 35 */ /* --- cacheline 5 boundary (320 bytes) was 31 bytes ago --- */ unsigned char abyScanBSSID[6]; /* 351 6 */ /* XXX 3 bytes hole, try to pack */ WMAC_AUTHENTICATION_MODE eAuthenMode; /* 360 4 */ WMAC_ENCRYPTION_MODE eEncryptionMode; /* 364 4 */ bool bShareKeyAlgorithm; /* 368 1 */ unsigned char abyChallenge[128]; /* 369 128 */ /* --- cacheline 7 boundary (448 bytes) was 49 bytes ago --- */ bool bPrivacyInvoked; /* 497 1 */ bool bInTIM; /* 498 1 */ bool bMulticastTIM; /* 499 1 */ unsigned char byDTIMCount; /* 500 1 */ unsigned char byDTIMPeriod; /* 501 1 */ /* XXX 2 bytes hole, try to pack */ WMAC_POWER_MODE ePSMode; /* 504 4 */ short unsigned int wListenInterval; /* 508 2 */ short unsigned int wCountToWakeUp; /* 510 2 */ /* --- cacheline 8 boundary (512 bytes) --- */ bool bInTIMWake; /* 512 1 */ /* XXX 3 bytes hole, try to pack */ unsigned char * pbyPSPacketPool; /* 516 4 */ unsigned char byPSPacketPool[36]; /* 520 36 */ bool bRxBeaconInTBTTWake; /* 556 1 */ unsigned char abyPSTxMap[65]; /* 557 65 */ /* XXX 2 bytes hole, try to pack */ /* --- cacheline 9 boundary (576 bytes) was 48 bytes ago --- */ unsigned int uCmdBusy; /* 624 4 */ unsigned int uCmdHostAPBusy; /* 628 4 */ unsigned char * pbyMgmtPacketPool; /* 632 4 */ unsigned char byMgmtPacketPool[2352]; /* 636 2352 */ /* --- cacheline 46 boundary (2944 bytes) was 44 bytes ago --- */ struct timer_list sTimerSecondCallback; /* 2988 52 */ /* --- cacheline 47 boundary (3008 bytes) was 32 bytes ago --- */ SRxMgmtPacket sRxPacket; /* 3040 28 */ KnownBSS sBSSList[42]; /* 3068 57288 */ /* --- cacheline 943 boundary (60352 bytes) was 4 bytes ago --- */ KnownNodeDB sNodeDBTable[65]; /* 60356 20800 */ /* --- cacheline 1268 boundary (81152 bytes) was 4 bytes ago --- */ /* Bitfield combined with previous fields */ SPMKIDCache gsPMKIDCache; /* 0 356 */ bool bRoaming; /* 0 1 */ SAssocInfo sAssocInfo; /* 0 7064 */ bool b11hEnable; /* 0 1 */ bool bSwitchChannel; /* 0 1 */ unsigned char byNewChannel; /* 0 1 */ PWLAN_IE_MEASURE_REP pCurrMeasureEIDRep; /* 0 4 */ unsigned int uLengthOfRepEIDs; /* 0 4 */ unsigned char abyCurrentMSRReq[2352]; /* 0 2352 */ unsigned char abyCurrentMSRRep[2352]; /* 0 2352 */ unsigned char abyIECountry[2340]; /* 0 2340 */ unsigned char abyIBSSDFSOwner[6]; /* 0 6 */ unsigned char byIBSSDFSRecovery; /* 0 1 */ struct sk_buff skb; /* 0 192 */ /* XXX last struct has 4 bytes of padding */ /* --- cacheline 1497 boundary (95808 bytes) was 32 bytes ago --- */ /* size: 95840, cachelines: 1498, members: 81 */ /* sum members: 95813, holes: 13, sum holes: 27 */ /* padding: 30112 */ /* paddings: 1, sum paddings: 4 */ /* last cacheline: 32 bytes */ /* BRAIN FART ALERT! 95840 != 95813 + 27(holes), diff = 0 */ }; struct pmkid_candidate { NDIS_802_11_MAC_ADDRESS BSSID; /* 0 6 */ /* XXX 2 bytes hole, try to pack */ long unsigned int Flags; /* 8 4 */ /* size: 12, cachelines: 1, members: 2 */ /* sum members: 10, holes: 1, sum holes: 2 */ /* last cacheline: 12 bytes */ }; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aya Mahfouz authored
This patch focuses on fixing the following warning generated by checkpatch.pl for the file dpc.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. Here is the output of pahole for the relevant datastructures: struct tagS802_11Header { short unsigned int wFrameCtl; /* 0 2 */ short unsigned int wDurationID; /* 2 2 */ unsigned char abyAddr1[6]; /* 4 6 */ unsigned char abyAddr2[6]; /* 10 6 */ unsigned char abyAddr3[6]; /* 16 6 */ short unsigned int wSeqCtl; /* 22 2 */ unsigned char abyAddr4[6]; /* 24 6 */ /* size: 30, cachelines: 1, members: 7 */ /* last cacheline: 30 bytes */ }; struct iw_michaelmicfailure { __u32 flags; /* 0 4 */ struct sockaddr src_addr; /* 4 16 */ __u8 tsc[8]; /* 20 8 */ /* size: 28, cachelines: 1, members: 3 */ /* last cacheline: 28 bytes */ }; struct sockaddr { sa_family_t sa_family; /* 0 2 */ char sa_data[14]; /* 2 14 */ /* size: 16, cachelines: 1, members: 2 */ /* last cacheline: 16 bytes */ }; There is one thing to note though, sa_data is a char array of size 14. And the number of bytes copied using memcpy() or ether_addr_copy() is 6. Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-
Aya Mahfouz authored
This patch focuses on fixing the following warning generated by checkpatch.pl for the file rxtx.c : Prefer ether_addr_copy() over memcpy() if the Ethernet addresses are __aligned(2) The changes were applied using the following coccinelle rule: @@ expression e1, e2; @@ - memcpy(e1, e2, ETH_ALEN); + ether_addr_copy(e1, e2); According to ether_addr_copy() description and functionality, all Ethernet addresses should align to the u16 datatype. Here is the output of pahole for the relevant datastructures: struct pmkid_candidate { NDIS_802_11_MAC_ADDRESS BSSID; /* 0 6 */ /* XXX 2 bytes hole, try to pack */ long unsigned int Flags; /* 8 4 */ /* size: 12, cachelines: 1, members: 2 */ /* sum members: 10, holes: 1, sum holes: 2 */ /* last cacheline: 12 bytes */ }; Signed-off-by: Aya Mahfouz <mahfouz.saif.elyazal@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-