It is not a good idea to let users to request a very high buffer
size.
So, add an upper limit.
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
#include "dvbdev.h"
#include "dvb_vb2.h"
+#define DVB_V2_MAX_SIZE (4096 * 188)
+
static int vb2_debug;
module_param(vb2_debug, int, 0644);
{
int ret;
+ /* Adjust size to a sane value */
+ if (req->size > DVB_V2_MAX_SIZE)
+ req->size = DVB_V2_MAX_SIZE;
+
+ /* FIXME: round req->size to a 188 or 204 multiple */
+
ctx->buf_siz = req->size;
ctx->buf_cnt = req->count;
ret = vb2_core_reqbufs(&ctx->vb_q, VB2_MEMORY_MMAP, &req->count);