pps: fix padding issue with PPS_FETCH for ioctl_compat

Issue is that x86 32-bit aligns to 4-bytes instead of 8-bytes
so this patchset works around the issue and corrects the data
returned in pps_fdata_compat.

Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Signed-off-by: Matt Ranostay <matt.ranostay@konsulko.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Matt Ranostay
2017-03-10 15:19:45 -08:00
committed by Greg Kroah-Hartman
parent 2ac6665701
commit c2a49fe8ee
2 changed files with 98 additions and 31 deletions

View File

@@ -55,6 +55,12 @@ struct pps_ktime {
__s32 nsec;
__u32 flags;
};
struct pps_ktime_compat {
__s64 sec;
__s32 nsec;
__u32 flags;
} __attribute__((packed, aligned(4)));
#define PPS_TIME_INVALID (1<<0) /* used to specify timeout==NULL */
struct pps_kinfo {
@@ -65,6 +71,14 @@ struct pps_kinfo {
int current_mode; /* current mode bits */
};
struct pps_kinfo_compat {
__u32 assert_sequence; /* seq. num. of assert event */
__u32 clear_sequence; /* seq. num. of clear event */
struct pps_ktime_compat assert_tu; /* time of assert event */
struct pps_ktime_compat clear_tu; /* time of clear event */
int current_mode; /* current mode bits */
};
struct pps_kparams {
int api_version; /* API version # */
int mode; /* mode bits */
@@ -114,6 +128,11 @@ struct pps_fdata {
struct pps_ktime timeout;
};
struct pps_fdata_compat {
struct pps_kinfo_compat info;
struct pps_ktime_compat timeout;
};
struct pps_bind_args {
int tsformat; /* format of time stamps */
int edge; /* selected event type */