/[linux-patches]/genpatches-2.6/tags/2.6.30-10/1510_hid-move-deref-below-null-test.patch
Gentoo

Contents of /genpatches-2.6/tags/2.6.30-10/1510_hid-move-deref-below-null-test.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1628 - (show annotations) (download)
Fri Nov 6 12:34:12 2009 UTC (9 years ago) by mpagano
File size: 1514 byte(s)
2.6.30-10 release
1 From: Julia Lawall <julia@diku.dk>
2 Date: Sun, 19 Jul 2009 15:26:13 +0000 (+0200)
3 Subject: HID: Move dereferences below a NULL test
4 X-Git-Tag: v2.6.31-rc4~14^2
5 X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=76c317d6e5cb7f58541879006d39774596962715
6
7 HID: Move dereferences below a NULL test
8
9 If the NULL test is necessary, then the dereferences should be moved below
10 the NULL test.
11
12 The semantic patch that makes this change is as follows:
13 (http://www.emn.fr/x-info/coccinelle/)
14
15 // <smpl>
16 @@
17 type T;
18 expression E,E1;
19 identifier i,fld;
20 statement S;
21 @@
22
23 - T i = E->fld;
24 + T i;
25 ... when != E=E1
26 when != i
27 if (E == NULL||...) S
28 + i = E->fld;
29 // </smpl>
30
31 Signed-off-by: Julia Lawall <julia@diku.dk>
32 Signed-off-by: Jiri Kosina <jkosina@suse.cz>
33 ---
34
35 diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
36 index f2c21d5..5eb10c2 100644
37 --- a/drivers/hid/hid-core.c
38 +++ b/drivers/hid/hid-core.c
39 @@ -1075,14 +1075,16 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
40 */
41 int hid_input_report(struct hid_device *hid, int type, u8 *data, int size, int interrupt)
42 {
43 - struct hid_report_enum *report_enum = hid->report_enum + type;
44 - struct hid_driver *hdrv = hid->driver;
45 + struct hid_report_enum *report_enum;
46 + struct hid_driver *hdrv;
47 struct hid_report *report;
48 unsigned int i;
49 int ret;
50
51 if (!hid || !hid->driver)
52 return -ENODEV;
53 + report_enum = hid->report_enum + type;
54 + hdrv = hid->driver;
55
56 if (!size) {
57 dbg_hid("empty report\n");
58

  ViewVC Help
Powered by ViewVC 1.1.20