aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/um/os-Linux/mem.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/arch/um/os-Linux/mem.c b/arch/um/os-Linux/mem.c
index 38742c21def5..93a11d7edfa0 100644
--- a/arch/um/os-Linux/mem.c
+++ b/arch/um/os-Linux/mem.c
@@ -162,11 +162,6 @@ found:
162 goto out; 162 goto out;
163} 163}
164 164
165/*
166 * This proc still used in tt-mode
167 * (file: kernel/tt/ptproxy/proxy.c, proc: start_debugger).
168 * So it isn't 'static' yet.
169 */
170static int __init make_tempfile(const char *template, char **out_tempname, 165static int __init make_tempfile(const char *template, char **out_tempname,
171 int do_unlink) 166 int do_unlink)
172{ 167{
@@ -175,10 +170,13 @@ static int __init make_tempfile(const char *template, char **out_tempname,
175 170
176 which_tmpdir(); 171 which_tmpdir();
177 tempname = malloc(MAXPATHLEN); 172 tempname = malloc(MAXPATHLEN);
178 if (!tempname) 173 if (tempname == NULL)
179 goto out; 174 return -1;
180 175
181 find_tempdir(); 176 find_tempdir();
177 if ((tempdir == NULL) || (strlen(tempdir) >= MAXPATHLEN))
178 return -1;
179
182 if (template[0] != '/') 180 if (template[0] != '/')
183 strcpy(tempname, tempdir); 181 strcpy(tempname, tempdir);
184 else 182 else
@@ -196,9 +194,8 @@ static int __init make_tempfile(const char *template, char **out_tempname,
196 } 194 }
197 if (out_tempname) { 195 if (out_tempname) {
198 *out_tempname = tempname; 196 *out_tempname = tempname;
199 } else { 197 } else
200 free(tempname); 198 free(tempname);
201 }
202 return fd; 199 return fd;
203out: 200out:
204 free(tempname); 201 free(tempname);