Content-Type: multipart/mixed; boundary="===============7447376605441134619==" MIME-Version: 1.0 From: ramesh.thomas at intel.com Subject: [Accel-config] [PATCH v1 5/5] accel-config: static analysis bug fix Date: Fri, 04 Dec 2020 15:50:32 -0500 Message-ID: <20201204205031.310835-6-ramesh.thomas@intel.com> In-Reply-To: 20201204205031.310835-1-ramesh.thomas@intel.com To: accel-config@lists.01.org List-ID: --===============7447376605441134619== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Ramesh Thomas Move dereferencing of dev after the null check Signed-off-by: Ramesh Thomas --- accfg/lib/libaccfg.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/accfg/lib/libaccfg.c b/accfg/lib/libaccfg.c index c321035..3b53be3 100644 --- a/accfg/lib/libaccfg.c +++ b/accfg/lib/libaccfg.c @@ -1110,12 +1110,13 @@ ACCFG_EXPORT int accfg_device_get_clients(struct ac= cfg_device *device) ACCFG_EXPORT int accfg_device_set_token_limit(struct accfg_device *dev, in= t val) { struct accfg_ctx *ctx; - char *path =3D dev->device_buf; + char *path; char buf[SYSFS_ATTR_SIZE]; = if (!dev) return -EINVAL; = + path =3D dev->device_buf; ctx =3D accfg_device_get_ctx(dev); = if (sprintf(path, "%s/token_limit", dev->device_path) >=3D -- = 2.26.2 --===============7447376605441134619==--