Skip to content

Commit c53bd2e

Browse files
committed
c2port: annotate bitfield for kmemcheck
This silences a false positive warning with kmemcheck. Signed-off-by: Vegard Nossum <vegard.nossum@gmail.com>
1 parent 9e337b0 commit c53bd2e

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

‎drivers/misc/c2port/core.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
#include <linux/errno.h>
1616
#include <linux/err.h>
1717
#include <linux/kernel.h>
18+
#include <linux/kmemcheck.h>
1819
#include <linux/ctype.h>
1920
#include <linux/delay.h>
2021
#include <linux/idr.h>
@@ -891,6 +892,7 @@ struct c2port_device *c2port_device_register(char *name,
891892
return ERR_PTR(-EINVAL);
892893

893894
c2dev = kmalloc(sizeof(struct c2port_device), GFP_KERNEL);
895+
kmemcheck_annotate_bitfield(c2dev, flags);
894896
if (unlikely(!c2dev))
895897
return ERR_PTR(-ENOMEM);
896898

‎include/linux/c2port.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*/
1111

1212
#include <linux/device.h>
13+
#include <linux/kmemcheck.h>
1314

1415
#define C2PORT_NAME_LEN 32
1516

@@ -20,8 +21,10 @@
2021
/* Main struct */
2122
struct c2port_ops;
2223
struct c2port_device {
24+
kmemcheck_bitfield_begin(flags);
2325
unsigned int access:1;
2426
unsigned int flash_access:1;
27+
kmemcheck_bitfield_end(flags);
2528

2629
int id;
2730
char name[C2PORT_NAME_LEN];

0 commit comments

Comments
 (0)