diff options
author | Ahmad Fatoum <ahmad@a3f.at> | 2017-07-08 15:28:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-07-11 16:34:54 -0400 |
commit | 5e34fa23ced16f03fe163d3f31fddcae91c3f2fc (patch) | |
tree | c5e742e1695d69a338cc34a33364ed70e2371683 | |
parent | f4e27944f9cf9a94dd9b37a834512586c1f1a5d2 (diff) |
net: Fix minor code bug in timestamping.txt
Passing (void*)val instead of &val would make a pointer out of an integer
and cause sock_setsockopt to -EFAULT.
See tools/testing/selftests/networking/timestamping/timestamping.c
for a working example.
Cc: David S. Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | Documentation/networking/timestamping.txt | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Documentation/networking/timestamping.txt b/Documentation/networking/timestamping.txt index 196ba17cc344..1be0b6f9e0cb 100644 --- a/Documentation/networking/timestamping.txt +++ b/Documentation/networking/timestamping.txt | |||
@@ -44,8 +44,7 @@ timeval of SO_TIMESTAMP (ms). | |||
44 | Supports multiple types of timestamp requests. As a result, this | 44 | Supports multiple types of timestamp requests. As a result, this |
45 | socket option takes a bitmap of flags, not a boolean. In | 45 | socket option takes a bitmap of flags, not a boolean. In |
46 | 46 | ||
47 | err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, (void *) val, | 47 | err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val)); |
48 | sizeof(val)); | ||
49 | 48 | ||
50 | val is an integer with any of the following bits set. Setting other | 49 | val is an integer with any of the following bits set. Setting other |
51 | bit returns EINVAL and does not change the current state. | 50 | bit returns EINVAL and does not change the current state. |
@@ -249,8 +248,7 @@ setsockopt to receive timestamps: | |||
249 | 248 | ||
250 | __u32 val = SOF_TIMESTAMPING_SOFTWARE | | 249 | __u32 val = SOF_TIMESTAMPING_SOFTWARE | |
251 | SOF_TIMESTAMPING_OPT_ID /* or any other flag */; | 250 | SOF_TIMESTAMPING_OPT_ID /* or any other flag */; |
252 | err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, (void *) val, | 251 | err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val)); |
253 | sizeof(val)); | ||
254 | 252 | ||
255 | 253 | ||
256 | 1.4 Bytestream Timestamps | 254 | 1.4 Bytestream Timestamps |