devlink: report 0 after hitting end in region read
[linux-2.6-microblaze.git] / net / core / devlink.c
index ca1df0e..549ee56 100644 (file)
@@ -3986,6 +3986,12 @@ static int devlink_nl_cmd_region_read_dumpit(struct sk_buff *skb,
                goto out_unlock;
        }
 
+       /* return 0 if there is no further data to read */
+       if (start_offset >= region->size) {
+               err = 0;
+               goto out_unlock;
+       }
+
        hdr = genlmsg_put(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq,
                          &devlink_nl_family, NLM_F_ACK | NLM_F_MULTI,
                          DEVLINK_CMD_REGION_READ);