public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2.6.19-rc2] fs/cifs/readdir.c: check kmalloc() return value.
@ 2006-10-16  7:39 Amit Choudhary
  0 siblings, 0 replies; only message in thread
From: Amit Choudhary @ 2006-10-16  7:39 UTC (permalink / raw)
  To: Linux Kernel

Description: Check the return value of kmalloc() in function cifs_readdir(), in file fs/cifs/readdir.c.

Signed-off-by: Amit Choudhary <amit2030@gmail.com>

diff --git a/fs/cifs/readdir.c b/fs/cifs/readdir.c
index b5b0a2a..2d43b2a 100644
--- a/fs/cifs/readdir.c
+++ b/fs/cifs/readdir.c
@@ -1063,6 +1063,11 @@ int cifs_readdir(struct file *file, void
 		such multibyte target UTF-8 characters. cifs_unicode.c,
 		which actually does the conversion, has the same limit */
 		tmp_buf = kmalloc((2 * NAME_MAX) + 4, GFP_KERNEL);
+		if (!tmp_buf) {
+			cERROR(1, ("No memory!"));
+			rc = -ENOMEM;
+			goto rddir2_exit;
+		}
 		for(i=0;(i<num_to_fill) && (rc == 0);i++) {
 			if(current_entry == NULL) {
 				/* evaluate whether this case is an error */

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2006-10-16  7:39 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-10-16  7:39 [PATCH 2.6.19-rc2] fs/cifs/readdir.c: check kmalloc() return value Amit Choudhary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox