浏览代码

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>
Johannes Berg 10 年之前
父节点
当前提交
36ef906ee8
共有 1 个文件被更改,包括 22 次插入0 次删除
  1. 22 0
      include/net/iw_handler.h

+ 22 - 0
include/net/iw_handler.h

@@ -519,6 +519,17 @@ iwe_stream_add_event(struct iw_request_info *info, char *stream, char *ends,
 	return stream;
 	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
  * 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;
 	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.
  * Wrapper to add a value to a Wireless Event in a stream of events.