xiaoxiang781216 commented on code in PR #8000:
URL: https://github.com/apache/nuttx/pull/8000#discussion_r1060063169


##########
drivers/video/video.c:
##########
@@ -3200,6 +3198,21 @@ static int video_ioctl(FAR struct file *filep, int cmd, 
unsigned long arg)
   return ret;
 }
 
+static int video_mmap(FAR struct file *filep, FAR struct mm_map_entry_s *map)
+{
+  FAR struct inode *inode = filep->f_inode;
+  FAR video_mng_t  *priv  = (FAR video_mng_t *)inode->i_private;
+  int ret = -EINVAL;
+
+  if (map)

Review Comment:
   let's add after get_bufsize:
   ```
   static size_t get_heapsize(FAR video_type_inf_t *type_inf)
   {
     return type_inf->bufinf.container_size *
            get_bufsize(&type_inf->fmt[VIDEO_FMT_MAIN]);
   }
   ```
   and do more check here:
   ```
   if (map->offset >= 0 && map->offset < get_heapsize(&priv->video_inf) &&
       map->offset + map->length <= get_heapsize(&priv->video_inf))
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to