DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: alejandro.lucero@netronome.com, dev@dpdk.org
Subject: [dpdk-dev] nfp doing its own pci_read_config
Date: Mon, 30 Apr 2018 08:19:42 -0700	[thread overview]
Message-ID: <20180430081942.1aa34385@xeon-e3> (raw)

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;

                 reply	other threads:[~2018-04-30 15:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180430081942.1aa34385@xeon-e3 \
    --to=stephen@networkplumber.org \
    --cc=alejandro.lucero@netronome.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).