From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf0-f68.google.com (mail-lf0-f68.google.com [209.85.215.68]) by dpdk.org (Postfix) with ESMTP id 2EE281B31B for ; Thu, 2 Nov 2017 09:37:57 +0100 (CET) Received: by mail-lf0-f68.google.com with SMTP id e143so5444560lfg.12 for ; Thu, 02 Nov 2017 01:37:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=semihalf-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=ffJ09WNpaS7eTDEQ0hjRSRPkYi5jX1qpiokXbVvMKPo=; b=dkwE01S3g8c3zn6cEmZ+qVq3XgZzMhe1gwsu7ZZvtJRtu1PWJaymrY+2I+jpDkkRPY WyBvGGisczU2yviSUrhMyZ8QXGdx6mXBuWZK3wk3MmGYY0xwhi10wKRBfAwW0+2ijrvq U0wXcQmmVRFeqNia6FiAUhLZfixGOXgu/+uGi+bH5xQ5k8qTdgecs0WN2LUWaj0MrOZ9 W4Tv+RQ3od3LoBmck3+Ijl1NQnXw2AJ0r12SdSlHjITIBDC/+4+hROH+BEPqSKvd1Bng 2XJVPcJJ+YBwDuDXnkSIrUw2/OSKJo2F2+/tf3j6eY/NWTiEhZ4/1QFYo8NbJp4uxrRZ yp8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=ffJ09WNpaS7eTDEQ0hjRSRPkYi5jX1qpiokXbVvMKPo=; b=PWRVHCg7XyG8HrNtjyDia+kJBCgowH38skfTaR8BiERUC+K/c2oN9/DPmmkg3eaSty 6lglY4x9iO3PLSlO6pQeBmZtPwOGtMy9a/CifXycaaLaOke1p+oOxYLgyzlCUeadTG/Y wZOLriq4ea7lNa3t2uIQD/St18lLPVKKMBk7Liug3R1bAztC50Nl19zdFx4GQl617DAV jSmhFVMFLhe12zPZYRnse92SSp4uTlOtihihAJ97qa+pR3yR30navCAvKzDK00KXOotG WqkQVf0myoNmHqH5L+6OcfQKrgwzVtp8jo8qGequMTy6EDdFFg1xge7CMxOfbdzVnEmk gDPg== X-Gm-Message-State: AJaThX7Cnar6ORNjVBhODWqlauhlp0cbfzTiucx8Kdy6wDavuOmJikhB IjB/ScK1dvxOs9xxQwWRrAwCxx0K1yg= X-Google-Smtp-Source: ABhQp+RuQKkZHYSrLGFREllevO6htrY9PwTVpi+xN9l7C3qhx8u2ro8NfKj/lYKTEGZq8Kzk01oc6A== X-Received: by 10.25.18.169 with SMTP id 41mr779906lfs.166.1509611876365; Thu, 02 Nov 2017 01:37:56 -0700 (PDT) Received: from tdu.semihalf.local (31-172-191-173.noc.fibertech.net.pl. [31.172.191.173]) by smtp.gmail.com with ESMTPSA id h63sm555220lji.35.2017.11.02.01.37.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Nov 2017 01:37:55 -0700 (PDT) From: Tomasz Duszynski To: dev@dpdk.org Cc: Tomasz Duszynski Date: Thu, 2 Nov 2017 09:37:25 +0100 Message-Id: <1509611845-19698-1-git-send-email-tdu@semihalf.com> X-Mailer: git-send-email 2.7.4 Subject: [dpdk-dev] [PATCH] net/mrvl: reset errno before library call X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Nov 2017 08:37:57 -0000 In case errno contains some non-zero value and call to strtoul() is successful -2 error will be returned. Setting errno to zero before calling strtoul() makes sure errors will be handled correctly. Fixes: 0ddc9b815b11 ("net/mrvl: add net PMD skeleton") Signed-off-by: Tomasz Duszynski --- drivers/net/mrvl/mrvl_qos.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/mrvl/mrvl_qos.c b/drivers/net/mrvl/mrvl_qos.c index 55f6406..2076228 100644 --- a/drivers/net/mrvl/mrvl_qos.c +++ b/drivers/net/mrvl/mrvl_qos.c @@ -122,6 +122,7 @@ get_val_securely(const char *string, uint32_t *val) if (len == 0) return -1; + errno = 0; *val = strtoul(string, &endptr, 0); if (errno != 0 || RTE_PTR_DIFF(endptr, string) != len) return -2; -- 2.7.4