From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by dpdk.org (Postfix) with ESMTP id 4D351DD2 for ; Mon, 30 Apr 2018 17:19:45 +0200 (CEST) Received: by mail-pf0-f196.google.com with SMTP id f189so6978915pfa.7 for ; Mon, 30 Apr 2018 08:19:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=mP5PgthOiCdOFCxMwVdGs0aROan5ln+C0cIeBAW59IY=; b=mr+GpTqiYNoyt4+ZgDamNSBBZW/tVQIV/suTGSUw/sUZTuk1JaVKBcGGjSKIMmpMMj cZuAMmfTGTV0+AQauhLKxgJcOOZMAVt3Oc6VMMnc7aoCN0bNS6zRJ2LVPBrjeEl7YleT wkphiXxnmo27sTGYF7+u30XyytgCozgtYjTzbw9y4EKNF5VUu/Th7P6r1G7QinjEaxq0 ctzMSeyz2e0rno3xCXhtT9kxc40l1DmfdGVqLeSwXO3l8l/GDi51PNa/qMwFQb59p31u ClI9+ILD1xsr1GIg76T1pJZzgdJnsuRgdObm35+5ncDN3Czy1UnrPWnPa5N0vS0pCZTw XsXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-transfer-encoding; bh=mP5PgthOiCdOFCxMwVdGs0aROan5ln+C0cIeBAW59IY=; b=FbZ6IJ9IdXrJSn0PMpzOH36DmG7292NHXdehUUX+FxuePY8V7/TLirw9RysBSxntnT oe+IpKffJdGwLZMXxdA+V2nQdTHf21xXdXGwBq3tlW9P69BziNEudMRDbNmGBcrKGzs6 22BM3/fEPBgUgjvzDXzOtLd3bciXJ1B6tnGA8OsMANS7VkSKvekh6M8t/oIruqzQXagn BU7Zb2AeJBFuyWD8ABl9Ru6L1eE+AUgbzC3KpumffhkbiIqLL1qV926JAjNAbXohToeG S1D+ladyyGXWx2frhbXvyMZFI+hTOdoDmsrPMSI0c+jmtHTBP/HQqPZvm5TsPgpetWX+ b+sg== X-Gm-Message-State: ALQs6tA8KqJukjI4tb6yFVeUSVWM1/ddtGjqRyHczDkwIfqxd0W+41GN tieDzH4y5K2ci84MKg6/DSTjZQ== X-Google-Smtp-Source: AB8JxZrOPucuDyP5bf1NDUj+ZUgPW6qQMdCDywAUtik0F+91Uk7xQp0pF9MQzPsAKjPQopouKMkDNw== X-Received: by 2002:a63:b80a:: with SMTP id p10-v6mr10275074pge.250.1525101584360; Mon, 30 Apr 2018 08:19:44 -0700 (PDT) Received: from xeon-e3 (204-195-33-219.wavecable.com. [204.195.33.219]) by smtp.gmail.com with ESMTPSA id v12-v6sm12150494pgo.78.2018.04.30.08.19.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 30 Apr 2018 08:19:44 -0700 (PDT) Date: Mon, 30 Apr 2018 08:19:42 -0700 From: Stephen Hemminger To: alejandro.lucero@netronome.com, dev@dpdk.org Message-ID: <20180430081942.1aa34385@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: [dpdk-dev] nfp doing its own pci_read_config 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: Mon, 30 Apr 2018 15:19:45 -0000 Why is Netronome driver using its own version of existing rte_pci_read_config? And hard coding magic numbers for offsets. This shows up as Coverity error ________________________________________________________________________________________________________ *** CID 277243: Error handling issues (CHECKED_RETURN) /drivers/net/nfp/nfpcore/nfp_cpp_pcie_ops.c: 684 in nfp6000_set_interface() 678 desc->busdev); 679 680 fp = open(tmp_str, O_RDONLY); 681 if (!fp) 682 return -1; 683 >>> CID 277243: Error handling issues (CHECKED_RETURN) >>> Calling "lseek(fp, 340L, 0)" without checking return value. This library function may fail and return an error code. 684 lseek(fp, 0x154, SEEK_SET); 685 686 if (read(fp, &tmp, sizeof(tmp)) != sizeof(tmp)) { 687 printf("error reading config file for interface\n"); 688 return -1; 689 static int nfp6000_set_model(struct nfp_pcie_user *desc, struct nfp_cpp *cpp) { char tmp_str[80]; uint32_t tmp; int fp; snprintf(tmp_str, sizeof(tmp_str), "%s/%s/config", PCI_DEVICES, desc->busdev); fp = open(tmp_str, O_RDONLY); if (!fp) return -1; lseek(fp, 0x2e, SEEK_SET); if (read(fp, &tmp, sizeof(tmp)) != sizeof(tmp)) { printf("Error reading config file for model\n"); return -1; } tmp = tmp << 16;