16 Jun, 2017

1 commit

  • A common pattern with skb_put() is to just want to memcpy()
    some data into the new space, introduce skb_put_data() for
    this.

    An spatch similar to the one for skb_put_zero() converts many
    of the places using it:

    @@
    identifier p, p2;
    expression len, skb, data;
    type t, t2;
    @@
    (
    -p = skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    |
    -p = (t)skb_put(skb, len);
    +p = skb_put_data(skb, data, len);
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, len);
    |
    -memcpy(p, data, len);
    )

    @@
    type t, t2;
    identifier p, p2;
    expression skb, data;
    @@
    t *p;
    ...
    (
    -p = skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    |
    -p = (t *)skb_put(skb, sizeof(t));
    +p = skb_put_data(skb, data, sizeof(t));
    )
    (
    p2 = (t2)p;
    -memcpy(p2, data, sizeof(*p));
    |
    -memcpy(p, data, sizeof(*p));
    )

    @@
    expression skb, len, data;
    @@
    -memcpy(skb_put(skb, len), data, len);
    +skb_put_data(skb, data, len);

    (again, manually post-processed to retain some comments)

    Reviewed-by: Stephen Hemminger
    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     

21 Mar, 2016

1 commit

  • 'struct timeval' uses 32-bit representation for seconds which will
    overflow in year 2038 and beyond. mISDN/clock.c needs to compute and
    store elapsed time in intervals of 125 microseconds. This patch replaces
    the usage of 'struct timeval' with 64-bit ktime_t which is y2038 safe.
    The patch also replaces do_gettimeofday() (wall-clock time) with
    ktime_get() (monotonic time) since we only care about elapsed time here.

    Signed-off-by: Tina Ruchandani
    Suggested-by: Arnd Bergmnann
    Suggested-by: David Miller
    Signed-off-by: David S. Miller

    Tina Ruchandani
     

17 May, 2012

1 commit

  • If the FIFO of the card is small, many short messages are queued up to
    the upper layers and the userspace. This change allows the applications
    to set a minimum datalen they want from the drivers.
    Create a common control function to avoid code duplication in each
    driver.

    Signed-off-by: Karsten Keil
    Signed-off-by: David S. Miller

    Karsten Keil
     

04 May, 2012

3 commits


03 Jun, 2010

1 commit


21 Sep, 2009

1 commit


26 Jul, 2009

1 commit


25 May, 2009

3 commits


12 Jan, 2009

1 commit

  • daxtar example # modprobe hfcsusb
    daxtar example # modprobe mISDN_l1loop
    daxtar example # ./misdnportinfo
    Found 3 devices
    id: 0
    Dprotocols: 00000006
    Bprotocols: 0000000e
    protocol: 0
    nrbchan: 2
    name: HFC-S_USB.1
    id: 1
    Dprotocols: 00000006
    Bprotocols: 0000000e
    protocol: 0
    nrbchan: 2
    name: mISDN_l1loop.1
    id: 2
    Dprotocols: 00000006
    Bprotocols: 0000000e
    protocol: 0
    nrbchan: 2
    name: mISDN_l1loop.2
    daxtar example # rmmod hfcsusb
    daxtar example # ./misdnportinfo
    Found 2 devices
    *Segmentation* *fault*

    dmesg:

    [ 9914.939718] BUG: unable to handle kernel NULL pointer dereference at 000000d4
    [ 9914.939721] IP: [] :mISDN_core:get_mdevice+0x19/0x22
    [ 9914.939729] *pde = 00000000
    [ 9914.939732] Oops: 0000 [#14] PREEMPT SMP
    [ 9914.939734] Modules linked in: mISDN_l1loop mISDN_core vmnet vmblock vmci vmmon coretemp w83627ehf hwmon_vid rfcomm l2cap blue
    tooth usbhid snd_usb_audio snd_usb_lib snd_rawmidi snd_hwdep fuse nvidia(P) uhci_hcd i2c_i801 ehci_hcd snd_hda_intel atl1 usbcore i2c_core parport_seria
    l [last unloaded: hfcsusb]
    [ 9914.939751] Pid: 29618, comm: misdnportinfo Tainted: P D (2.6.27.3 #5)
    [ 9914.939753] EIP: 0060:[] EFLAGS: 00210246 CPU: 0
    [ 9914.939758] EIP is at get_mdevice+0x19/0x22 [mISDN_core]
    [ 9914.939760] EAX: 00000000 EBX: f8fa791c ECX: f6afaa58 EDX: f7960cf4
    [ 9914.939762] ESI: 80044944 EDI: bfc2e62c EBP: bfc2e62c ESP: f5adbef4
    [ 9914.939763] DS: 007b ES: 007b FS: 00d8 GS: 0033 SS: 0068
    [ 9914.939765] Process misdnportinfo (pid: 29618, ti=f5ada000 task=f6bec430 task.ti=f5ada000)
    [ 9914.939767] Stack: f8f9f4e0 00000000 f8f9f867 bfc2e62c 0000000a c02461e8 00200246 c042dde8
    [ 9914.939771] 00000003 c042dde4 00000000 00000001 00200082 c0114775 00000000 00000000
    [ 9914.939775] 00000003 f7088010 00200282 f8fa791c 80044944 bfc2e62c bfc2e62c c02f6615
    [ 9914.939780] Call Trace:
    [ 9914.939782] [] _get_mdevice+0x0/0x18 [mISDN_core]
    [ 9914.939789] [] base_sock_ioctl+0x7a/0x129 [mISDN_core]
    [ 9914.939789] [] opost+0x171/0x182
    [ 9914.939789] [] __wake_up+0x29/0x39
    [ 9914.939789] [] sock_ioctl+0x1b5/0x1d9
    [ 9914.939789] [] sock_ioctl+0x0/0x1d9
    [ 9914.939789] [] vfs_ioctl+0x1c/0x5d
    [ 9914.939789] [] do_vfs_ioctl+0x23e/0x24e
    [ 9914.939789] [] sys_ioctl+0x2c/0x45
    [ 9914.939789] [] sysenter_do_call+0x12/0x21
    [ 9914.939789] [] pci_fixup_i450gx+0x4e/0x56
    [ 9914.939789] =======================
    [ 9914.939789] Code: 00 68 02 f0 f9 f8 e8 ae b4 2c c7 8b 44 24 04 5a 59 c3 83 ec 04 31 d2 89 04 24 89 e1 b8 ac df fa f8 68 e0 f4
    f9 f8 e8 4a b5 2c c7 80 d4 00 00 00 5a 59 c3 53 89 cb 8d 90 9c 00 00 00 89 c8 e8
    [ 9914.939789] EIP: [] get_mdevice+0x19/0x22 [mISDN_core] SS:ESP 0068:f5adbef4
    [ 9914.939858] ---[ end trace 50e18a715b019424 ]---

    Signed-off-by: Martin Bachem
    Signed-off-by: Karsten Keil

    Martin Bachem
     

10 Jan, 2009

9 commits


02 Aug, 2008

1 commit


27 Jul, 2008

1 commit