linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch 5/6] drivers/ide/* - compile warning cleanup
@ 2005-03-06 10:42 domen
  0 siblings, 0 replies; 2+ messages in thread
From: domen @ 2005-03-06 10:42 UTC (permalink / raw)
  To: B.Zolnierkiewicz; +Cc: linux-ide, domen, yrgrknmxpzlk


compile warning cleanup - handle copy_to/from_user error returns

Signed-off-by: Stephen Biggs <yrgrknmxpzlk@gawab.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---


 kj-domen/drivers/ide/ide-tape.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff -puN drivers/ide/ide-tape.c~return_code-drivers_ide drivers/ide/ide-tape.c
--- kj/drivers/ide/ide-tape.c~return_code-drivers_ide	2005-03-05 16:13:05.000000000 +0100
+++ kj-domen/drivers/ide/ide-tape.c	2005-03-05 16:13:05.000000000 +0100
@@ -2610,7 +2610,13 @@ static void idetape_copy_stage_from_user
 		}
 #endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n);
-		copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count);
+		if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) {
+#if IDETAPE_DEBUG_BUGS
+			printk(KERN_ERR "ide-tape/%s: copy_from_user failed!\n",
+					__FUNCTION__);
+#endif /* IDETAPE_DEBUG_BUGS */
+			return;
+		}
 		n -= count;
 		atomic_add(count, &bh->b_count);
 		buf += count;
@@ -2637,7 +2643,12 @@ static void idetape_copy_stage_to_user (
 		}
 #endif /* IDETAPE_DEBUG_BUGS */
 		count = min(tape->b_count, n);
-		copy_to_user(buf, tape->b_data, count);
+		if (copy_to_user(buf, tape->b_data, count)) {
+#if IDETAPE_DEBUG_BUGS
+			printk(KERN_ERR "ide-tape/%s: copy_to_user failed!\n",__FUNCTION__);
+#endif /* IDETAPE_DEBUG_BUGS */
+			return;
+		}
 		n -= count;
 		tape->b_data += count;
 		tape->b_count -= count;
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [patch 5/6] drivers/ide/* - compile warning cleanup
@ 2005-06-20 21:52 domen
  0 siblings, 0 replies; 2+ messages in thread
From: domen @ 2005-06-20 21:52 UTC (permalink / raw)
  To: B.Zolnierkiewicz; +Cc: linux-ide, Stephen Biggs, domen

[-- Attachment #1: return_code-drivers_ide.patch --]
[-- Type: text/plain, Size: 1494 bytes --]

From: "Stephen Biggs" <yrgrknmxpzlk@gawab.com>


compile warning cleanup - handle copy_to/from_user error returns

Signed-off-by: Stephen Biggs <yrgrknmxpzlk@gawab.com>
Signed-off-by: Domen Puncer <domen@coderock.org>
---
 ide-tape.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

Index: quilt/drivers/ide/ide-tape.c
===================================================================
--- quilt.orig/drivers/ide/ide-tape.c
+++ quilt/drivers/ide/ide-tape.c
@@ -2656,7 +2656,13 @@ static void idetape_copy_stage_from_user
 		}
 #endif /* IDETAPE_DEBUG_BUGS */
 		count = min((unsigned int)(bh->b_size - atomic_read(&bh->b_count)), (unsigned int)n);
-		copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count);
+		if (copy_from_user(bh->b_data + atomic_read(&bh->b_count), buf, count)) {
+#if IDETAPE_DEBUG_BUGS
+			printk(KERN_ERR "ide-tape/%s: copy_from_user failed!\n",
+					__FUNCTION__);
+#endif /* IDETAPE_DEBUG_BUGS */
+			return;
+		}
 		n -= count;
 		atomic_add(count, &bh->b_count);
 		buf += count;
@@ -2683,7 +2689,12 @@ static void idetape_copy_stage_to_user (
 		}
 #endif /* IDETAPE_DEBUG_BUGS */
 		count = min(tape->b_count, n);
-		copy_to_user(buf, tape->b_data, count);
+		if (copy_to_user(buf, tape->b_data, count)) {
+#if IDETAPE_DEBUG_BUGS
+			printk(KERN_ERR "ide-tape/%s: copy_to_user failed!\n",__FUNCTION__);
+#endif /* IDETAPE_DEBUG_BUGS */
+			return;
+		}
 		n -= count;
 		tape->b_data += count;
 		tape->b_count -= count;

--

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-06-20 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-20 21:52 [patch 5/6] drivers/ide/* - compile warning cleanup domen
  -- strict thread matches above, loose matches on Subject: below --
2005-03-06 10:42 domen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).