Commit 5e34fa23 authored by Ahmad Fatoum's avatar Ahmad Fatoum Committed by David S. Miller

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: default avatarAhmad Fatoum <ahmad@a3f.at>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f4e27944
...@@ -44,8 +44,7 @@ timeval of SO_TIMESTAMP (ms). ...@@ -44,8 +44,7 @@ timeval of SO_TIMESTAMP (ms).
Supports multiple types of timestamp requests. As a result, this Supports multiple types of timestamp requests. As a result, this
socket option takes a bitmap of flags, not a boolean. In socket option takes a bitmap of flags, not a boolean. In
err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, (void *) val, err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val));
sizeof(val));
val is an integer with any of the following bits set. Setting other val is an integer with any of the following bits set. Setting other
bit returns EINVAL and does not change the current state. bit returns EINVAL and does not change the current state.
...@@ -249,8 +248,7 @@ setsockopt to receive timestamps: ...@@ -249,8 +248,7 @@ setsockopt to receive timestamps:
__u32 val = SOF_TIMESTAMPING_SOFTWARE | __u32 val = SOF_TIMESTAMPING_SOFTWARE |
SOF_TIMESTAMPING_OPT_ID /* or any other flag */; SOF_TIMESTAMPING_OPT_ID /* or any other flag */;
err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, (void *) val, err = setsockopt(fd, SOL_SOCKET, SO_TIMESTAMPING, &val, sizeof(val));
sizeof(val));
1.4 Bytestream Timestamps 1.4 Bytestream Timestamps
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment