From: Johannes Berg Date: Wed, 25 Feb 2015 09:54:33 +0000 (+0100) Subject: wext: add checked wrappers for adding events/points to streams X-Git-Tag: Ubuntu-5.0.0-8.9~9586^2~105^2~63 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=36ef906ee8fefbfac3844206e66d8450e6221c69;p=mirror_ubuntu-disco-kernel.git 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 --- 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.