patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Gagandeep Singh <G.Singh@nxp.com>
To: wangyunjian <wangyunjian@huawei.com>,
	"dev@dpdk.org" <dev@dpdk.org>, Akhil Goyal <akhil.goyal@nxp.com>
Cc: Hemant Agrawal <hemant.agrawal@nxp.com>,
	"jerry.lilijun@huawei.com" <jerry.lilijun@huawei.com>,
	"xudingke@huawei.com" <xudingke@huawei.com>,
	"stable@dpdk.org" <stable@dpdk.org>
Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH] crypto/caam_jr: fix wrong check of fd
Date: Sat, 9 May 2020 17:44:09 +0000	[thread overview]
Message-ID: <VI1PR04MB696004741482A27C7B5FAD37E1A30@VI1PR04MB6960.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <1587906052-1548-1-git-send-email-wangyunjian@huawei.com>



> -----Original Message-----
> From: wangyunjian <wangyunjian@huawei.com>
> Sent: Sunday, April 26, 2020 6:31 PM
> To: dev@dpdk.org
> Cc: Gagandeep Singh <G.Singh@nxp.com>; Hemant Agrawal
> <hemant.agrawal@nxp.com>; jerry.lilijun@huawei.com;
> xudingke@huawei.com; Yunjian Wang <wangyunjian@huawei.com>;
> stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] crypto/caam_jr: fix wrong check of fd
> 
> From: Yunjian Wang <wangyunjian@huawei.com>
> 
> Zero is a valid fd. It will fail to check the fd if the fd is zero.
> 
> Fixes: e7a45f3cc245 ("crypto/caam_jr: add UIO specific operations")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
> ---
>  drivers/crypto/caam_jr/caam_jr_uio.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c
> b/drivers/crypto/caam_jr/caam_jr_uio.c
> index b1bb44ca4..658de5460 100644
> --- a/drivers/crypto/caam_jr/caam_jr_uio.c
> +++ b/drivers/crypto/caam_jr/caam_jr_uio.c
> @@ -145,7 +145,7 @@ file_read_first_line(const char root[], const char
> subdir[],
>  		 "%s/%s/%s", root, subdir, filename);
> 
>  	fd = open(absolute_file_name, O_RDONLY);
> -	SEC_ASSERT(fd > 0, fd, "Error opening file %s",
> +	SEC_ASSERT(fd >= 0, fd, "Error opening file %s",
>  			absolute_file_name);
> 
>  	/* read UIO device name from first line in file */
> @@ -389,7 +389,7 @@ uio_job_ring *config_job_ring(void)
> 
>  	/* Open device file */
>  	job_ring->uio_fd = open(uio_device_file_name, O_RDWR);
> -	SEC_ASSERT(job_ring->uio_fd > 0, NULL,
> +	SEC_ASSERT(job_ring->uio_fd >= 0, NULL,
>  		"Failed to open UIO device file for job ring %d",
>  		job_ring->jr_id);
> 
> @@ -488,7 +488,7 @@ sec_cleanup(void)
>  		/* I need to close the fd after shutdown UIO commands need to
> be
>  		 * sent using the fd
>  		 */
> -		if (job_ring->uio_fd != 0) {
> +		if (job_ring->uio_fd >= 0) {
>  			CAAM_JR_INFO(
>  			"Closed device file for job ring %d , fd = %d",
>  			job_ring->jr_id, job_ring->uio_fd);
> --
> 2.19.1
> 


Reviewed-by: Gagandeep Singh <G.singh@nxp.com>



  reply	other threads:[~2020-05-09 17:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-26 13:00 wangyunjian
2020-05-09 17:44 ` Gagandeep Singh [this message]
2020-05-10  5:53   ` Gagandeep Singh
2020-05-11  2:13     ` wangyunjian

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=VI1PR04MB696004741482A27C7B5FAD37E1A30@VI1PR04MB6960.eurprd04.prod.outlook.com \
    --to=g.singh@nxp.com \
    --cc=akhil.goyal@nxp.com \
    --cc=dev@dpdk.org \
    --cc=hemant.agrawal@nxp.com \
    --cc=jerry.lilijun@huawei.com \
    --cc=stable@dpdk.org \
    --cc=wangyunjian@huawei.com \
    --cc=xudingke@huawei.com \
    /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).