anchao commented on code in PR #7616:
URL: https://github.com/apache/nuttx/pull/7616#discussion_r1037777406


##########
net/devif/devif_iobsend.c:
##########
@@ -53,19 +53,77 @@
  ****************************************************************************/
 
 void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
-                    unsigned int len, unsigned int offset)
+                    unsigned int len, unsigned int offset,
+                    unsigned int target_offset)
 {
-  if (dev == NULL || len == 0 || len >= NETDEV_PKTSIZE(dev))
+  unsigned int limit = NETDEV_PKTSIZE(dev) -
+                       NET_LL_HDRLEN(dev) - target_offset;
+  unsigned int copyin;
+  int ret;
+
+  if (dev == NULL || len == 0 || len > limit)
     {
-      nerr("devif_iob_send error, %p, send len: %u, pkt len: %u\n",
-                                          dev, len, NETDEV_PKTSIZE(dev));
+      if (dev->d_iob == NULL)
+        {
+          iob_free_chain(iob);
+        }
+
+      nerr("devif_iob_send error, %p, send len: %u, limit len: %u\n",
+            dev, len, limit);

Review Comment:
   Done



-- 
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