diff options
author | Johannes Berg <johannes.berg@intel.com> | 2015-02-25 10:54:33 +0100 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2015-02-28 21:31:12 +0100 |
commit | 36ef906ee8fefbfac3844206e66d8450e6221c69 (patch) | |
tree | 6c6a1d4212dc70fd686e7a64be2039b61e87ba99 /include/net | |
parent | abfbc3af57b1b92ff976ce7f1c776c169d14ed8a (diff) | |
download | blackbird-op-linux-36ef906ee8fefbfac3844206e66d8450e6221c69.tar.gz blackbird-op-linux-36ef906ee8fefbfac3844206e66d8450e6221c69.zip |
wext: add checked wrappers for adding events/points to streams
These checked wrappers are necessary for the next patch, which
will use them to avoid sending out partial scan results.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/net')
-rw-r--r-- | include/net/iw_handler.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/include/net/iw_handler.h b/include/net/iw_handler.h index a830b01baba4..8f81bbbc38fc 100644 --- a/include/net/iw_handler.h +++ b/include/net/iw_handler.h @@ -519,6 +519,17 @@ iwe_stream_add_event(struct iw_request_info *info, char *stream, char *ends, return stream; } +static inline char * +iwe_stream_add_event_check(struct iw_request_info *info, char *stream, + char *ends, struct iw_event *iwe, int event_len) +{ + char *res = iwe_stream_add_event(info, stream, ends, iwe, event_len); + + if (res == stream) + return ERR_PTR(-E2BIG); + return res; +} + /*------------------------------------------------------------------*/ /* * Wrapper to add an short Wireless Event containing a pointer to a @@ -545,6 +556,17 @@ iwe_stream_add_point(struct iw_request_info *info, char *stream, char *ends, return stream; } +static inline char * +iwe_stream_add_point_check(struct iw_request_info *info, char *stream, + char *ends, struct iw_event *iwe, char *extra) +{ + char *res = iwe_stream_add_point(info, stream, ends, iwe, extra); + + if (res == stream) + return ERR_PTR(-E2BIG); + return res; +} + /*------------------------------------------------------------------*/ /* * Wrapper to add a value to a Wireless Event in a stream of events. |