Commit Graph

47 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 2aed63f427 tree-wide: fix spelling of "fallback"
Similarly to "setup" vs. "set up", "fallback" is a noun, and "fall back"
is the verb. (This is pretty clear when we construct a sentence in the
present continous: "we are falling back" not "we are fallbacking").
2020-08-20 17:45:32 +02:00
Yu Watanabe 455fa9610c tree-wide: drop string.h when string-util.h or friends are included 2019-11-04 00:30:32 +09:00
Yu Watanabe 25de7aa7b9 udev: modernize udev-rules.c
This does the following:
- rename enum udev_builtin_cmd -> UdevBuiltinCmd
- rename struct udev_builtin -> UdevBuiltin
- move type definitions to udev-rules.h
- move prototypes of functions defined in udev-rules.c to udev-rules.h
- drop to use strbuf
- propagate critical errors in applying rules,
- drop limitation for number of tokens per line.
2019-06-02 14:15:26 +09:00
Frantisek Sumsal 4e361acc06 tree-wide: replace explicit NULL checks with their shorter variants
Done by coccinelle/equals-null.cocci
2019-04-28 14:28:49 +02:00
Zbigniew Jędrzejewski-Szmek 760034bebe udev-builtin-usb_id: guard against overflow when reading descriptor data
CID#996458. Coverity warns that we trust desc->bLength as read in
the input data to adjust our position in the buffer. This value could
be anything, leading to overflow. It's unlikely that the kernel feeds
us invalid data, but let's me more careful.

If any error is encountered, more logs are given.
2019-02-28 11:57:51 +01:00
Zbigniew Jędrzejewski-Szmek 8bdca77c40 udev-builtin-usb_id: use strjoina to simplify code 2019-02-28 11:40:44 +01:00
Yu Watanabe 5ea78a39e5 libudev-list: move libudev-list related definitions to libudev-list-internal.h
This also rename libudev-private.h to libudev-util.h, and cleanups
several unnecessary headers from udev.h and libudev-util.h
2018-11-20 14:38:35 +09:00
Yu Watanabe 9a6e5c24ba udev-builtin-usb_id: update log messages 2018-10-24 04:31:48 +09:00
Yu Watanabe d354690e7d udev-builtin: propagate negative errno 2018-10-23 18:29:25 +09:00
Yu Watanabe 3fc2e9a247 udev: replace udev_device by sd_device from prototype of udev builtin commands 2018-10-23 18:28:38 +09:00
Yu Watanabe 71bd61c576 udev: replace udev_device by sd_device in udev-builtin-usb_id.c 2018-10-23 18:28:38 +09:00
Yu Watanabe 0c9c063477 udev: make udev_builtin_add_property() take sd_device instead of udev_device 2018-10-23 17:51:34 +09:00
Yu Watanabe 07a26e42da udev-builtin: move definitions related to builtin commands to udev-builtin.h 2018-10-11 04:21:14 +09:00
Yu Watanabe f330408d62 tree-wide: drop empty lines in comments 2018-07-23 08:44:24 +02:00
Zbigniew Jędrzejewski-Szmek d9b02e1697 tree-wide: drop copyright headers from frequent contributors
Fixes #9320.

for p in Shapovalov Chevalier Rozhkov Sievers Mack Herrmann Schmidt Rudenberg Sahani Landden Andersen Watanabe; do
  git grep -e 'Copyright.*'$p -l|xargs perl -i -0pe 's|/([*][*])?[*]\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\s*[*]([*][*])?/\n*|\n|gms; s|\s+([*#]\s+)?Copyright[^\n]*'$p'[^\n]*\n*|\n|gms'
done
2018-06-20 11:58:53 +02:00
Zbigniew Jędrzejewski-Szmek 50d1760d26 Drop more license boilerplate
$ git grep -e 'This program is free software' -l |grep -v LICENSE | \
  xargs perl -i -0pe 's/ \* This program.*?for more details.\s*\*\n( \* You should have.*licenses.>.\n)?//gms'

For some reason they were missed previously. All those files seem to
have proper SDPX tags.
2018-06-14 13:05:41 +02:00
Lennart Poettering 810adae9e9 tree-wide: use proper unicode © instead of (C) where we can
Let's use a proper unicode copyright symbol where we can, it's prettier.

This important patch is very important.
2018-06-14 10:20:20 +02:00
Filipe Brandenburger 9d635f50b8 udev-builtin-usb_id: Check full range of size returned by read()
This shouldn't be necessary, since read() should never return a size
larger than the size of the buffer passed in, but Coverity doesn't seem
to understand that.

We could possibly fix this with a model file for Coverity, but given
changing the code is not that much of a biggie, let's just do that
instead.

Fixes CID 996458: Overflowed or truncated value (or a value computed
from an overflowed or truncated value) `pos` used as array index.

Tested: `ninja -C build/ test`, builds without warnings, test cases pass.
2018-06-08 00:46:44 +02:00
Zbigniew Jędrzejewski-Szmek e7145211c7 Add SPDX license identifiers to source files under the GPL 2017-11-19 19:08:15 +01:00
Yu Watanabe 4c70109600 tree-wide: use IN_SET macro (#6977) 2017-10-04 16:01:32 +02:00
Daniel Mack b26fa1a2fb tree-wide: remove Emacs lines from all files
This should be handled fine now by .dir-locals.el, so need to carry that
stuff in every file.
2016-02-10 13:41:57 +01:00
Zbigniew Jędrzejewski-Szmek 3f65d73149 udev: add emacs header line
Otherwise emacs wants to use 2-space indentation and other
attrocities.
2015-12-07 00:45:08 -05:00
Lennart Poettering b5efdb8af4 util-lib: split out allocation calls into alloc-util.[ch] 2015-10-27 13:45:53 +01:00
Lennart Poettering 3ffd4af220 util-lib: split out fd-related operations into fd-util.[ch]
There are more than enough to deserve their own .c file, hence move them
over.
2015-10-25 13:19:18 +01:00
Lennart Poettering 07630cea1f util-lib: split our string related calls from util.[ch] into its own file string-util.[ch]
There are more than enough calls doing string manipulations to deserve
its own files, hence do something about it.

This patch also sorts the #include blocks of all files that needed to be
updated, according to the sorting suggestions from CODING_STYLE. Since
pretty much every file needs our string manipulation functions this
effectively means that most files have sorted #include blocks now.

Also touches a few unrelated include files.
2015-10-24 23:05:02 +02:00
Tom Gundersen 3b64e4d4f4 udev: add some asserts
Mostly for documentation purposes.
2015-06-02 18:12:47 +02:00
Zbigniew Jędrzejewski-Szmek 38b9855bfa udev-builtin-usb_id: fix inverted condition
Fix for 4beac74e69.

Thanks, Ronny!
2015-04-15 08:28:19 -04:00
Zbigniew Jędrzejewski-Szmek 4beac74e69 udev-builtin-usb_id: simplification 2015-04-14 12:39:14 -04:00
Lennart Poettering 8d8ce9e2cd udev: downgrade a few warnings to debug messages
https://bugs.freedesktop.org/show_bug.cgi?id=89885
2015-04-14 15:53:33 +02:00
Zbigniew Jędrzejewski-Szmek 24bfda116c udev: properly calculate size of remaining data
The data comes from the kernel, so chances of it being
garbled are low, but for correctness' sake, add the check.

CID #996458.
2015-03-13 23:42:17 -04:00
Lennart Poettering ea79e73b8a udev: use inttypes.h types wherever appropriate 2015-03-09 18:02:22 +01:00
Lennart Poettering 885fdebc13 tree-wide: use _packed_ macro instead of raw gcc __attribute__ 2015-03-09 18:02:22 +01:00
Lennart Poettering 5ac0162c3a udevadm,..: make --help output of udev tools more like the output of the various other tools 2015-01-05 13:19:55 +01:00
Kay Sievers 9ec6e95b04 udev: place opening { at the same line as the function declaration 2014-07-29 15:49:25 +02:00
Jan Engelhardt 73e231abde doc: update punctuation
Resolve spotted issues related to missing or extraneous commas, dashes.
2014-02-17 19:03:07 -05:00
Lennart Poettering 9f6445e34a log: log_error() and friends add a newline after each line anyway, so avoid including it in the log strings 2013-12-24 16:39:37 +01:00
Kay Sievers f6f2ad9b9c udev: usb_id - remove obsoleted bInterfaceSubClass == 5 match
bInterfaceSubClass == 5 is not a "floppy"; just identify the obsolete
QIC-157 interface as "generic".
2013-10-11 11:23:34 +02:00
Harald Hoyer 7fd1b19bc9 move _cleanup_ attribute in front of the type
http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
2013-04-18 09:11:22 +02:00
Zbigniew Jędrzejewski-Szmek bad490b051 udev-builtin-usb_id: avoid comparison of unsigned and ssize_t
For some reason this shows up on i686 only:
src/udev/udev-builtin-usb_id.c:192:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
2013-04-05 17:39:02 -04:00
Kay Sievers 7962afbba9 udev: usb_id: parse only 'size' bytes of the 'descriptors' buffer 2013-02-17 21:16:56 +01:00
Kay Sievers a2cbfd5916 udev: usb_id - ignore non-ASCII serial numbers
On Thu, Feb 7, 2013 at 3:52 PM, Robert Milasan <rmilasan@suse.com> wrote:
> Hi, seems that using some strange usb devices with really bogus serial
> numbers usb_id creates links with junk strings in it:
>
> /dev/disk/by-id/usb-TSSTcorp_BDDVDW_SE-506AB_㡒䍌䜶䉗ぁㄴ㌴†ँ-0:0
>
> Initially was believed that usb_id is to blame, then the kernel, but it
> turns out that really the usb cd/dvd drive has this bogus serial number:
>
> output from dmesg:
> [  538.200160] usb 1-2: new high-speed USB device number 5 using
> ehci_hcd [  538.335067] usb 1-2: New USB device found, idVendor=0e8d,
> idProduct=1956 [  538.335080] usb 1-2: New USB device strings: Mfr=1,
> Product=2, SerialNumber=3 [  538.335089] usb 1-2: Product: MT1956
> [  538.335097] usb 1-2: Manufacturer: MediaTek Inc
> [  538.335105] usb 1-2: SerialNumber:
> \xffffffe3\xffffffa1\xffffff92\xffffffe4\xffffff8d\xffffff8c ...
> [  538.337540] scsi6 : usb-storage 1-2:1.0 [  539.341385] scsi 6:0:0:0:
> CD-ROM            TSSTcorp BDDVDW SE-506AB  TS00 PQ: 0 ANSI: 0
> [  539.354240] sr0: scsi3-mmc drive: 0x/24x writer dvd-ram cd/rw
> xa/form2 cdda tray [  539.354777] sr 6:0:0:0: Attached scsi CD-ROM sr0
> [  539.355122] sr 6:0:0:0: Attached scsi generic sg2 type 5
2013-02-17 21:16:08 +01:00
Thomas Hindoe Paaboel Andersen 090be86534 use streq instead of strcmp 2013-02-13 18:14:20 +01:00
Kay Sievers d5a89d7dc1 udev: move string copy functions to shared/ 2013-01-09 19:06:46 +01:00
Kay Sievers 1298001ec5 use the same email address everywhere 2012-11-12 19:47:43 +01:00
Kay Sievers 04a9d3a00a udev: fix gcc warnings showing up after adding $(AM_CFLAGS) 2012-04-10 17:27:46 +02:00
Kay Sievers baa30fbc2c udev: switch to systemd logging functions 2012-04-08 16:06:20 +02:00
Kay Sievers 3e2147858f move imported udev into place 2012-04-04 05:05:07 +02:00
Renamed from src/udev/src/udev-builtin-usb_id.c (Browse further)