File: 0001-Initialize-variables.patch

package info (click to toggle)
infinipath-psm 3.3+19.g67c0807.open-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,644 kB
  • ctags: 4,684
  • sloc: ansic: 34,269; makefile: 334; asm: 47
file content (40 lines) | stat: -rw-r--r-- 1,388 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From 07ed87dfcf13dcab3bd2b78340972b0130c99f20 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ana=20Guerrero=20L=C3=B3pez?= <ana@ekaia.org>
Date: Thu, 31 Mar 2016 23:17:11 +0200
Subject: [PATCH] Initialize variables

This patch fixes the following -Werror=maybe-uninitialized errors:

psm_diags.c:294:10: error: 'dst_p' may be used uninitialized in this function [-Werror=maybe-uninitialized]
       if (dst_p) psmi_free(dst_p);
          ^
In file included from psm_user.h:54:0,
                 from psm_diags.c:35:
psm_utils.h:156:23: error: 'src_p' may be used uninitialized in this function [-Werror=maybe-uninitialized]
 #define psmi_free(sz) psmi_free_internal(sz)
                       ^
psm_diags.c:290:11: note: 'src_p' was declared here
     void *src_p, *dst_p;
           ^
If posix_memalign fails to return a value different than zero,
the pointers are never initialized.
---
 psm_diags.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/psm_diags.c b/psm_diags.c
index b6fedd9..3e2df9d 100644
--- a/psm_diags.c
+++ b/psm_diags.c
@@ -287,7 +287,7 @@ memcpy_check_size (memcpy_fn_t fn, int *p, int *f, size_t n)
       return -1;
   }
   else {
-    void *src_p, *dst_p;
+    void *src_p = NULL, *dst_p = NULL;
     if (posix_memalign(&src_p, 64, size) != 0 ||
         posix_memalign(&dst_p, 64, size) != 0) {
       if (src_p) psmi_free(src_p);
-- 
2.8.0.rc3