* [dpdk-dev] [PATCH v2] librte_eal: fix wrong assert for arm and ppc
@ 2017-09-21 15:59 Lukasz Majczak
2017-09-22 8:31 ` Jan Viktorin
2017-09-25 7:34 ` [dpdk-dev] [PATCH v3] " Lukasz Majczak
0 siblings, 2 replies; 6+ messages in thread
From: Lukasz Majczak @ 2017-09-21 15:59 UTC (permalink / raw)
To: viktorin, chaozhu; +Cc: dev, Lukasz Majczak
The assertion of return value from the open() function is done against
0, while it is a correct value - open() returns -1 in case of an error.
It causes problems while trying to run as a daemon, in which case, this
call to open() will return 0 as a valid descriptor.
Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
---
lib/librte_eal/common/arch/arm/rte_cpuflags.c | 2 +-
lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
index 5636e9c1d..88f1cbe37 100644
--- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
@@ -137,7 +137,7 @@ rte_cpu_get_features(hwcap_registers_t out)
_Elfx_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {
if (auxv.a_type == AT_HWCAP) {
out[REG_HWCAP] = auxv.a_un.a_val;
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
index fcf96e045..970a61c5e 100644
--- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
@@ -108,7 +108,7 @@ rte_cpu_get_features(hwcap_registers_t out)
Elf64_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv,
sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
if (auxv.a_type == AT_HWCAP)
--
2.14.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v2] librte_eal: fix wrong assert for arm and ppc
2017-09-21 15:59 [dpdk-dev] [PATCH v2] librte_eal: fix wrong assert for arm and ppc Lukasz Majczak
@ 2017-09-22 8:31 ` Jan Viktorin
2017-09-25 7:34 ` [dpdk-dev] [PATCH v3] " Lukasz Majczak
1 sibling, 0 replies; 6+ messages in thread
From: Jan Viktorin @ 2017-09-22 8:31 UTC (permalink / raw)
To: Lukasz Majczak; +Cc: chaozhu, dev
On Thu, 21 Sep 2017 17:59:53 +0200
Lukasz Majczak <lma@semihalf.com> wrote:
> The assertion of return value from the open() function is done against
> 0, while it is a correct value - open() returns -1 in case of an error.
> It causes problems while trying to run as a daemon, in which case, this
> call to open() will return 0 as a valid descriptor.
I'd put an empty line here...
> Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
> Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
> Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
>
> Signed-off-by: Lukasz Majczak <lma@semihalf.com>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v3] librte_eal: fix wrong assert for arm and ppc
2017-09-21 15:59 [dpdk-dev] [PATCH v2] librte_eal: fix wrong assert for arm and ppc Lukasz Majczak
2017-09-22 8:31 ` Jan Viktorin
@ 2017-09-25 7:34 ` Lukasz Majczak
2017-09-28 2:01 ` Chao Zhu
2017-09-28 6:54 ` [dpdk-dev] [PATCH v4] " Lukasz Majczak
1 sibling, 2 replies; 6+ messages in thread
From: Lukasz Majczak @ 2017-09-25 7:34 UTC (permalink / raw)
To: dev; +Cc: Lukasz Majczak
The assertion of return value from the open() function is done against
0, while it is a correct value - open() returns -1 in case of an error.
It causes problems while trying to run as a daemon, in which case, this
call to open() will return 0 as a valid descriptor.
Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
---
lib/librte_eal/common/arch/arm/rte_cpuflags.c | 2 +-
lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
index 5636e9c1d..88f1cbe37 100644
--- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
@@ -137,7 +137,7 @@ rte_cpu_get_features(hwcap_registers_t out)
_Elfx_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {
if (auxv.a_type == AT_HWCAP) {
out[REG_HWCAP] = auxv.a_un.a_val;
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
index fcf96e045..970a61c5e 100644
--- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
@@ -108,7 +108,7 @@ rte_cpu_get_features(hwcap_registers_t out)
Elf64_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv,
sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
if (auxv.a_type == AT_HWCAP)
--
2.14.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v3] librte_eal: fix wrong assert for arm and ppc
2017-09-25 7:34 ` [dpdk-dev] [PATCH v3] " Lukasz Majczak
@ 2017-09-28 2:01 ` Chao Zhu
2017-09-28 6:54 ` [dpdk-dev] [PATCH v4] " Lukasz Majczak
1 sibling, 0 replies; 6+ messages in thread
From: Chao Zhu @ 2017-09-28 2:01 UTC (permalink / raw)
To: 'Lukasz Majczak', dev
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Lukasz Majczak
> Sent: 2017年9月25日 15:35
> To: dev@dpdk.org
> Cc: Lukasz Majczak <lma@semihalf.com>
> Subject: [dpdk-dev] [PATCH v3] librte_eal: fix wrong assert for arm and
ppc
>
> The assertion of return value from the open() function is done against 0,
while it
> is a correct value - open() returns -1 in case of an error.
> It causes problems while trying to run as a daemon, in which case, this
call to
> open() will return 0 as a valid descriptor.
>
> Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
> Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
> Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
>
> Signed-off-by: Lukasz Majczak <lma@semihalf.com>
> ---
> lib/librte_eal/common/arch/arm/rte_cpuflags.c | 2 +-
> lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
> b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
> index 5636e9c1d..88f1cbe37 100644
> --- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
> +++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
> @@ -137,7 +137,7 @@ rte_cpu_get_features(hwcap_registers_t out)
> _Elfx_auxv_t auxv;
>
> auxv_fd = open("/proc/self/auxv", O_RDONLY);
> - assert(auxv_fd);
> + assert(auxv_fd != -1);
> while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {
> if (auxv.a_type == AT_HWCAP) {
> out[REG_HWCAP] = auxv.a_un.a_val;
> diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
> b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
> index fcf96e045..970a61c5e 100644
> --- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
> +++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
> @@ -108,7 +108,7 @@ rte_cpu_get_features(hwcap_registers_t out)
> Elf64_auxv_t auxv;
>
> auxv_fd = open("/proc/self/auxv", O_RDONLY);
> - assert(auxv_fd);
> + assert(auxv_fd != -1);
> while (read(auxv_fd, &auxv,
> sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
> if (auxv.a_type == AT_HWCAP)
> --
> 2.14.1
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [dpdk-dev] [PATCH v4] librte_eal: fix wrong assert for arm and ppc
2017-09-25 7:34 ` [dpdk-dev] [PATCH v3] " Lukasz Majczak
2017-09-28 2:01 ` Chao Zhu
@ 2017-09-28 6:54 ` Lukasz Majczak
2017-10-05 22:16 ` Thomas Monjalon
1 sibling, 1 reply; 6+ messages in thread
From: Lukasz Majczak @ 2017-09-28 6:54 UTC (permalink / raw)
To: dev; +Cc: stable, Lukasz Majczak
The assertion of return value from the open() function is done against
0, while it is a correct value - open() returns -1 in case of an error.
It causes problems while trying to run as a daemon, in which case, this
call to open() will return 0 as a valid descriptor.
Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
Signed-off-by: Lukasz Majczak <lma@semihalf.com>
Acked-by: Jan Viktorin <viktorin@rehivetech.com>
Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
---
lib/librte_eal/common/arch/arm/rte_cpuflags.c | 2 +-
lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/arch/arm/rte_cpuflags.c b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
index 5636e9c1d..88f1cbe37 100644
--- a/lib/librte_eal/common/arch/arm/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/arm/rte_cpuflags.c
@@ -137,7 +137,7 @@ rte_cpu_get_features(hwcap_registers_t out)
_Elfx_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv, sizeof(auxv)) == sizeof(auxv)) {
if (auxv.a_type == AT_HWCAP) {
out[REG_HWCAP] = auxv.a_un.a_val;
diff --git a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
index fcf96e045..970a61c5e 100644
--- a/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
+++ b/lib/librte_eal/common/arch/ppc_64/rte_cpuflags.c
@@ -108,7 +108,7 @@ rte_cpu_get_features(hwcap_registers_t out)
Elf64_auxv_t auxv;
auxv_fd = open("/proc/self/auxv", O_RDONLY);
- assert(auxv_fd);
+ assert(auxv_fd != -1);
while (read(auxv_fd, &auxv,
sizeof(Elf64_auxv_t)) == sizeof(Elf64_auxv_t)) {
if (auxv.a_type == AT_HWCAP)
--
2.14.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [dpdk-dev] [PATCH v4] librte_eal: fix wrong assert for arm and ppc
2017-09-28 6:54 ` [dpdk-dev] [PATCH v4] " Lukasz Majczak
@ 2017-10-05 22:16 ` Thomas Monjalon
0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2017-10-05 22:16 UTC (permalink / raw)
To: Lukasz Majczak; +Cc: dev, stable
28/09/2017 08:54, Lukasz Majczak:
> The assertion of return value from the open() function is done against
> 0, while it is a correct value - open() returns -1 in case of an error.
> It causes problems while trying to run as a daemon, in which case, this
> call to open() will return 0 as a valid descriptor.
>
> Fixes: b94e5c9406b5 ("eal/arm: add CPU flags for ARMv7")
> Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
> Fixes: 9ae155385686 ("eal/ppc: cpu flag checks for IBM Power")
Cc: stable@dpdk.org
> Signed-off-by: Lukasz Majczak <lma@semihalf.com>
> Acked-by: Jan Viktorin <viktorin@rehivetech.com>
> Acked-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
Applied, thanks
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2017-10-05 22:16 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21 15:59 [dpdk-dev] [PATCH v2] librte_eal: fix wrong assert for arm and ppc Lukasz Majczak
2017-09-22 8:31 ` Jan Viktorin
2017-09-25 7:34 ` [dpdk-dev] [PATCH v3] " Lukasz Majczak
2017-09-28 2:01 ` Chao Zhu
2017-09-28 6:54 ` [dpdk-dev] [PATCH v4] " Lukasz Majczak
2017-10-05 22:16 ` Thomas Monjalon
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).