Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP5:Update
ndctl
ndctl-lib-inject-check-whether-cmd-is-created-s...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File ndctl-lib-inject-check-whether-cmd-is-created-successfully.patch of Package ndctl
From 63e09b67c531eeebd390cc71e3699eb430841460 Mon Sep 17 00:00:00 2001 From: Zhiqiang Liu <liuzhiqiang26@huawei.com> Date: Fri, 6 Nov 2020 17:27:09 +0800 Subject: [PATCH] lib/inject: check whether cmd is created successfully References: bsc#1170384 Patch-mainline: v71 Git-commit: 63e09b67c531eeebd390cc71e3699eb430841460 ndctl_bus_cmd_new_ars_cap() is called to create cmd, which may return NULL. We need to check whether it is NULL in callers, such as ndctl_namespace_get_clear_unit and ndctl_namespace_injection_status. Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com> Link: https://lore.kernel.org/r/8e8a88ee-a792-dc86-0fa7-b2609588fc88@huawei.com --- ndctl/lib/inject.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff -ur ndctl-64.1.orig/ndctl/lib/inject.c ndctl-64.1/ndctl/lib/inject.c --- ndctl-64.1.orig/ndctl/lib/inject.c 2019-02-06 01:45:14.000000000 +0100 +++ ndctl-64.1/ndctl/lib/inject.c 2021-01-06 14:37:42.613364331 +0100 @@ -101,6 +101,11 @@ ndctl_namespace_get_injection_bounds(ndns, &ns_offset, &ns_size); cmd = ndctl_bus_cmd_new_ars_cap(bus, ns_offset, ns_size); + if (!cmd) { + err(ctx, "%s: failed to create cmd\n", + ndctl_namespace_get_devname(ndns)); + return -ENOTTY; + } rc = ndctl_cmd_submit(cmd); if (rc < 0) { dbg(ctx, "Error submitting ars_cap: %d\n", rc); @@ -442,6 +447,11 @@ &ns_size); cmd = ndctl_bus_cmd_new_ars_cap(bus, ns_offset, ns_size); + if (!cmd) { + err(ctx, "%s: failed to create cmd\n", + ndctl_namespace_get_devname(ndns)); + return -ENOTTY; + } rc = ndctl_cmd_submit(cmd); if (rc < 0) { dbg(ctx, "Error submitting ars_cap: %d\n", rc);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor