[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [UNIKRAFT PATCH] lib/uknetdev: netdev register fails on lib param


  • To: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>, "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • From: "Jung, Alexander" <a.jung@xxxxxxxxxxxxxxx>
  • Date: Mon, 17 Aug 2020 13:56:01 +0000
  • Accept-language: en-GB, en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=lancaster.ac.uk; dmarc=pass action=none header.from=lancaster.ac.uk; dkim=pass header.d=lancaster.ac.uk; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=/FszEjH+RDQX2oGgTAb0CXmAnfo5oRJTTSDV4xsTQDo=; b=bgSf25SZw2n4XEEI1Je9slj6JFQp+L/3UU/99qV8Tx6HQQVv3sd/acuzhCHDMb9EHB+KfSN8FutjR81ZZa5QYReP0eZxj9PaE5wOfrKskVw3TKYK1cKMJzOL4GfXZu+WN8JxJA1iWFIF6WnVBiSoYVW/ub2MwGx6YmqzvM2Ti6FfqxgvQrT9q4R9vmSmbsHtXYIFGsZhEdIXa2/I443lInewssjTgQjSBndVTBQtBSKAfi5zqCfvJhXeUmbcrI600KelUggBQO3amSYTLPX1Gcsp1k6s1ctmEMbJFr+7FJucDu3FGReUBM4DZGb3d1EFOkjj7ZckniVyn4CY8xCxdQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jhdC8d+DkGrkGoeZxTE3O0uK2/uQOTJzUKgKvLIa5mMz+cLyuHRuPsNyP/Rd9nmAxTeAQA4yuS5LAC+WmKYpU4JX67VQ1f+g0n0Uw4wZHXhrQiwu+M6h51dv8JpgeXa24oSJ9ze/TAmeh59r1RbdE10oSt6+POiwbl/3f08e1+05y/H2IwtNJPUi8n1iR2YWaGkCam9TkaD4u68avuwTswRtSvlBZd9s2oFQzBl0R6WmMVjKKJ3JFEGt/riCQvYmxvUUfCQZirNhwciES4MyBzTxlT8PFZmHycVh6PIfytDuFznxfIiQNp7KybcLvryd+UZYbHWxbHqJRKmyRVS8kA==
  • Authentication-results: neclab.eu; dkim=none (message not signed) header.d=none;neclab.eu; dmarc=none action=none header.from=lancaster.ac.uk;
  • Delivery-date: Mon, 17 Aug 2020 13:56:13 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Thread-index: AQHWdJ4jXh90lD4WMUaCge6riTCyOw==
  • Thread-topic: [UNIKRAFT PATCH] lib/uknetdev: netdev register fails on lib param

Hi Sharan,

Thanks for the patch.  Tested and all good.

Reviewed-by: Alexander Jung <a.jung@xxxxxxxxxxx>


On 17.08.20, 01:35, "Minios-devel on behalf of Sharan Santhanam" 
<minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx on behalf of 
sharan.santhanam@xxxxxxxxx> wrote:

    einfo returns error when the user does not provide the library
    parameters.

    Signed-off-by: Sharan Santhanam <sharan.santhanam@xxxxxxxxx>
    ---
     lib/uknetdev/netdev.c | 26 +++++++++++++-------------
     1 file changed, 13 insertions(+), 13 deletions(-)

    diff --git a/lib/uknetdev/netdev.c b/lib/uknetdev/netdev.c
    index 74be618..87322c7 100644
    --- a/lib/uknetdev/netdev.c
    +++ b/lib/uknetdev/netdev.c
    @@ -120,18 +120,16 @@ static struct uk_netdev_einfo *_alloc_einfo(struct 
uk_alloc *a)
     {
        struct uk_netdev_einfo *_einfo = NULL;

    -   if (ipv4_addr || ipv4_subnet_mask || ipv4_gw_addr) {
    -           _einfo = uk_zalloc(a, sizeof(*_einfo));
    -           if (!_einfo) {
    -                   uk_pr_warn("Failed to allocate memory for netdev 
config\n");
    -                   return NULL;
    -           }
    -
    -           _einfo->ipv4_addr = _parse_ipv4_addr();
    -           _einfo->ipv4_net_mask = _parse_ipv4_net_mask();
    -           _einfo->ipv4_gw_addr = _parse_ipv4_gw_addr();
    +   _einfo = uk_zalloc(a, sizeof(*_einfo));
    +   if (!_einfo) {
    +           uk_pr_warn("Failed to allocate memory for netdev config\n");
    +           return ERR2PTR(-ENOMEM);
        }

    +   _einfo->ipv4_addr = _parse_ipv4_addr();
    +   _einfo->ipv4_net_mask = _parse_ipv4_net_mask();
    +   _einfo->ipv4_gw_addr = _parse_ipv4_gw_addr();
    +
        return _einfo;
     }

    @@ -162,9 +160,11 @@ int uk_netdev_drv_register(struct uk_netdev *dev, 
struct uk_alloc *a,
        if (!dev->_data)
                return -ENOMEM;

    -   dev->_einfo = _alloc_einfo(a);
    -   if (!dev->_einfo)
    -           return -ENOMEM;
    +   if (ipv4_addr || ipv4_subnet_mask || ipv4_gw_addr) {
    +           dev->_einfo = _alloc_einfo(a);
    +           if (PTRISERR(dev->_einfo))
    +                   return PTR2ERR(dev->_einfo);
    +   }

        UK_TAILQ_INSERT_TAIL(&uk_netdev_list, dev, _list);
        uk_pr_info("Registered netdev%"PRIu16": %p (%s)\n",
    -- 
    2.7.4



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.