DPDK patches and discussions
 help / color / mirror / Atom feed
From: Srikanth Yalavarthi <syalavarthi@marvell.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: Anup Prabhu <aprabhu@marvell.com>, "dev@dpdk.org" <dev@dpdk.org>,
	Shivah Shankar Shankar Narayan Rao <sshankarnara@marvell.com>,
	Prince Takkar <ptakkar@marvell.com>,
	Srikanth Yalavarthi <syalavarthi@marvell.com>
Subject: RE: [EXT] Re: [PATCH v5] app/mldev: add internal function for file read
Date: Wed, 7 Jun 2023 17:24:46 +0000	[thread overview]
Message-ID: <CO6PR18MB39394E5E4EB1C81BF936FAB7AE53A@CO6PR18MB3939.namprd18.prod.outlook.com> (raw)
In-Reply-To: <20230607094921.5b8b63c7@hermes.local>

> -----Original Message-----
> From: Stephen Hemminger <stephen@networkplumber.org>
> Sent: 07 June 2023 22:19
> To: Srikanth Yalavarthi <syalavarthi@marvell.com>
> Cc: Anup Prabhu <aprabhu@marvell.com>; dev@dpdk.org; Shivah Shankar
> Shankar Narayan Rao <sshankarnara@marvell.com>; Prince Takkar
> <ptakkar@marvell.com>
> Subject: [EXT] Re: [PATCH v5] app/mldev: add internal function for file read
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, 7 Jun 2023 09:20:30 -0700
> Srikanth Yalavarthi <syalavarthi@marvell.com> wrote:
> The normal case leaks the open file descriptor
> 
> +
> +	file_map = mmap(0, file_stat.st_size, PROT_READ, MAP_PRIVATE, fd,
> 0);
> +	if (file_map == MAP_FAILED) {
> +		ml_err("Failed to map file: %s\n", file);
> +		ret = -errno;
> +		goto error;
> +	}
> +
> +	rte_memcpy(file_buffer, file_map, file_stat.st_size);
> +	munmap(file_map, file_stat.st_size);
> +
> +	*size = file_stat.st_size;
> +	*buffer = file_buffer;
> +
> +	return 0;
> 
> Missing close()
> 
> > +	if (buffer)
> > +		free(buffer);
> > +
> 
> Another needless if()

Updated in v6.

  reply	other threads:[~2023-06-07 17:24 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-23 15:28 [PATCH 1/1] " Srikanth Yalavarthi
2023-03-28 15:52 ` Stephen Hemminger
2023-04-12  8:48   ` [EXT] " Srikanth Yalavarthi
2023-04-23  4:55 ` [PATCH v2] " Srikanth Yalavarthi
2023-05-03  8:56 ` [PATCH v3] " Srikanth Yalavarthi
2023-05-03 14:54   ` Stephen Hemminger
2023-05-03 14:59     ` [EXT] " Srikanth Yalavarthi
2023-05-03 18:28       ` Stephen Hemminger
2023-05-03 23:04         ` Tyler Retzlaff
2023-06-07 11:35 ` [PATCH v4] " Srikanth Yalavarthi
2023-06-07 15:02   ` Stephen Hemminger
2023-06-07 16:21     ` [EXT] " Srikanth Yalavarthi
2023-06-07 16:20 ` [PATCH v5] " Srikanth Yalavarthi
2023-06-07 16:49   ` Stephen Hemminger
2023-06-07 17:24     ` Srikanth Yalavarthi [this message]
2023-06-07 17:24 ` [PATCH v6] " Srikanth Yalavarthi
2023-07-07  8:06   ` Thomas Monjalon

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=CO6PR18MB39394E5E4EB1C81BF936FAB7AE53A@CO6PR18MB3939.namprd18.prod.outlook.com \
    --to=syalavarthi@marvell.com \
    --cc=aprabhu@marvell.com \
    --cc=dev@dpdk.org \
    --cc=ptakkar@marvell.com \
    --cc=sshankarnara@marvell.com \
    --cc=stephen@networkplumber.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).