diff options
-rw-r--r-- | sound/oss/dmasound/dmasound_atari.c | 54 |
1 files changed, 36 insertions, 18 deletions
diff --git a/sound/oss/dmasound/dmasound_atari.c b/sound/oss/dmasound/dmasound_atari.c index 59eb53f89318..b747e77238f8 100644 --- a/sound/oss/dmasound/dmasound_atari.c +++ b/sound/oss/dmasound/dmasound_atari.c | |||
@@ -217,8 +217,9 @@ static ssize_t ata_ct_u8(const u_char *userPtr, size_t userCount, | |||
217 | used = count*2; | 217 | used = count*2; |
218 | while (count > 0) { | 218 | while (count > 0) { |
219 | u_short data; | 219 | u_short data; |
220 | if (get_user(data, ((u_short *)userPtr)++)) | 220 | if (get_user(data, (u_short *)userPtr)) |
221 | return -EFAULT; | 221 | return -EFAULT; |
222 | userPtr += 2; | ||
222 | *p++ = data ^ 0x8080; | 223 | *p++ = data ^ 0x8080; |
223 | count--; | 224 | count--; |
224 | } | 225 | } |
@@ -240,8 +241,9 @@ static ssize_t ata_ct_s16be(const u_char *userPtr, size_t userCount, | |||
240 | used = count*2; | 241 | used = count*2; |
241 | while (count > 0) { | 242 | while (count > 0) { |
242 | u_short data; | 243 | u_short data; |
243 | if (get_user(data, ((u_short *)userPtr)++)) | 244 | if (get_user(data, (u_short *)userPtr)) |
244 | return -EFAULT; | 245 | return -EFAULT; |
246 | userPtr += 2; | ||
245 | *p++ = data; | 247 | *p++ = data; |
246 | *p++ = data; | 248 | *p++ = data; |
247 | count--; | 249 | count--; |
@@ -271,8 +273,9 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount, | |||
271 | used = count*2; | 273 | used = count*2; |
272 | while (count > 0) { | 274 | while (count > 0) { |
273 | u_short data; | 275 | u_short data; |
274 | if (get_user(data, ((u_short *)userPtr)++)) | 276 | if (get_user(data, (u_short *)userPtr)) |
275 | return -EFAULT; | 277 | return -EFAULT; |
278 | userPtr += 2; | ||
276 | data ^= 0x8000; | 279 | data ^= 0x8000; |
277 | *p++ = data; | 280 | *p++ = data; |
278 | *p++ = data; | 281 | *p++ = data; |
@@ -285,8 +288,9 @@ static ssize_t ata_ct_u16be(const u_char *userPtr, size_t userCount, | |||
285 | used = count*4; | 288 | used = count*4; |
286 | while (count > 0) { | 289 | while (count > 0) { |
287 | u_long data; | 290 | u_long data; |
288 | if (get_user(data, ((u_int *)userPtr)++)) | 291 | if (get_user(data, (u_int *)userPtr)) |
289 | return -EFAULT; | 292 | return -EFAULT; |
293 | userPtr += 4; | ||
290 | *p++ = data ^ 0x80008000; | 294 | *p++ = data ^ 0x80008000; |
291 | count--; | 295 | count--; |
292 | } | 296 | } |
@@ -309,8 +313,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount, | |||
309 | used = count*2; | 313 | used = count*2; |
310 | while (count > 0) { | 314 | while (count > 0) { |
311 | u_short data; | 315 | u_short data; |
312 | if (get_user(data, ((u_short *)userPtr)++)) | 316 | if (get_user(data, (u_short *)userPtr)) |
313 | return -EFAULT; | 317 | return -EFAULT; |
318 | userPtr += 2; | ||
314 | data = le2be16(data); | 319 | data = le2be16(data); |
315 | *p++ = data; | 320 | *p++ = data; |
316 | *p++ = data; | 321 | *p++ = data; |
@@ -323,8 +328,9 @@ static ssize_t ata_ct_s16le(const u_char *userPtr, size_t userCount, | |||
323 | used = count*4; | 328 | used = count*4; |
324 | while (count > 0) { | 329 | while (count > 0) { |
325 | u_long data; | 330 | u_long data; |
326 | if (get_user(data, ((u_int *)userPtr)++)) | 331 | if (get_user(data, (u_int *)userPtr)) |
327 | return -EFAULT; | 332 | return -EFAULT; |
333 | userPtr += 4; | ||
328 | data = le2be16dbl(data); | 334 | data = le2be16dbl(data); |
329 | *p++ = data; | 335 | *p++ = data; |
330 | count--; | 336 | count--; |
@@ -348,8 +354,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount, | |||
348 | used = count*2; | 354 | used = count*2; |
349 | while (count > 0) { | 355 | while (count > 0) { |
350 | u_short data; | 356 | u_short data; |
351 | if (get_user(data, ((u_short *)userPtr)++)) | 357 | if (get_user(data, (u_short *)userPtr)) |
352 | return -EFAULT; | 358 | return -EFAULT; |
359 | userPtr += 2; | ||
353 | data = le2be16(data) ^ 0x8000; | 360 | data = le2be16(data) ^ 0x8000; |
354 | *p++ = data; | 361 | *p++ = data; |
355 | *p++ = data; | 362 | *p++ = data; |
@@ -361,8 +368,9 @@ static ssize_t ata_ct_u16le(const u_char *userPtr, size_t userCount, | |||
361 | used = count; | 368 | used = count; |
362 | while (count > 0) { | 369 | while (count > 0) { |
363 | u_long data; | 370 | u_long data; |
364 | if (get_user(data, ((u_int *)userPtr)++)) | 371 | if (get_user(data, (u_int *)userPtr)) |
365 | return -EFAULT; | 372 | return -EFAULT; |
373 | userPtr += 4; | ||
366 | data = le2be16dbl(data) ^ 0x80008000; | 374 | data = le2be16dbl(data) ^ 0x80008000; |
367 | *p++ = data; | 375 | *p++ = data; |
368 | count--; | 376 | count--; |
@@ -470,8 +478,9 @@ static ssize_t ata_ctx_s8(const u_char *userPtr, size_t userCount, | |||
470 | if (bal < 0) { | 478 | if (bal < 0) { |
471 | if (userCount < 2) | 479 | if (userCount < 2) |
472 | break; | 480 | break; |
473 | if (get_user(data, ((u_short *)userPtr)++)) | 481 | if (get_user(data, (u_short *)userPtr)) |
474 | return -EFAULT; | 482 | return -EFAULT; |
483 | userPtr += 2; | ||
475 | userCount -= 2; | 484 | userCount -= 2; |
476 | bal += hSpeed; | 485 | bal += hSpeed; |
477 | } | 486 | } |
@@ -524,8 +533,9 @@ static ssize_t ata_ctx_u8(const u_char *userPtr, size_t userCount, | |||
524 | if (bal < 0) { | 533 | if (bal < 0) { |
525 | if (userCount < 2) | 534 | if (userCount < 2) |
526 | break; | 535 | break; |
527 | if (get_user(data, ((u_short *)userPtr)++)) | 536 | if (get_user(data, (u_short *)userPtr)) |
528 | return -EFAULT; | 537 | return -EFAULT; |
538 | userPtr += 2; | ||
529 | data ^= 0x8080; | 539 | data ^= 0x8080; |
530 | userCount -= 2; | 540 | userCount -= 2; |
531 | bal += hSpeed; | 541 | bal += hSpeed; |
@@ -561,8 +571,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount, | |||
561 | if (bal < 0) { | 571 | if (bal < 0) { |
562 | if (userCount < 2) | 572 | if (userCount < 2) |
563 | break; | 573 | break; |
564 | if (get_user(data, ((u_short *)userPtr)++)) | 574 | if (get_user(data, (u_short *)userPtr)) |
565 | return -EFAULT; | 575 | return -EFAULT; |
576 | userPtr += 2; | ||
566 | userCount -= 2; | 577 | userCount -= 2; |
567 | bal += hSpeed; | 578 | bal += hSpeed; |
568 | } | 579 | } |
@@ -579,8 +590,9 @@ static ssize_t ata_ctx_s16be(const u_char *userPtr, size_t userCount, | |||
579 | if (bal < 0) { | 590 | if (bal < 0) { |
580 | if (userCount < 4) | 591 | if (userCount < 4) |
581 | break; | 592 | break; |
582 | if (get_user(data, ((u_int *)userPtr)++)) | 593 | if (get_user(data, (u_int *)userPtr)) |
583 | return -EFAULT; | 594 | return -EFAULT; |
595 | userPtr += 4; | ||
584 | userCount -= 4; | 596 | userCount -= 4; |
585 | bal += hSpeed; | 597 | bal += hSpeed; |
586 | } | 598 | } |
@@ -615,8 +627,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount, | |||
615 | if (bal < 0) { | 627 | if (bal < 0) { |
616 | if (userCount < 2) | 628 | if (userCount < 2) |
617 | break; | 629 | break; |
618 | if (get_user(data, ((u_short *)userPtr)++)) | 630 | if (get_user(data, (u_short *)userPtr)) |
619 | return -EFAULT; | 631 | return -EFAULT; |
632 | userPtr += 2; | ||
620 | data ^= 0x8000; | 633 | data ^= 0x8000; |
621 | userCount -= 2; | 634 | userCount -= 2; |
622 | bal += hSpeed; | 635 | bal += hSpeed; |
@@ -634,8 +647,9 @@ static ssize_t ata_ctx_u16be(const u_char *userPtr, size_t userCount, | |||
634 | if (bal < 0) { | 647 | if (bal < 0) { |
635 | if (userCount < 4) | 648 | if (userCount < 4) |
636 | break; | 649 | break; |
637 | if (get_user(data, ((u_int *)userPtr)++)) | 650 | if (get_user(data, (u_int *)userPtr)) |
638 | return -EFAULT; | 651 | return -EFAULT; |
652 | userPtr += 4; | ||
639 | data ^= 0x80008000; | 653 | data ^= 0x80008000; |
640 | userCount -= 4; | 654 | userCount -= 4; |
641 | bal += hSpeed; | 655 | bal += hSpeed; |
@@ -671,8 +685,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount, | |||
671 | if (bal < 0) { | 685 | if (bal < 0) { |
672 | if (userCount < 2) | 686 | if (userCount < 2) |
673 | break; | 687 | break; |
674 | if (get_user(data, ((u_short *)userPtr)++)) | 688 | if (get_user(data, (u_short *)userPtr)) |
675 | return -EFAULT; | 689 | return -EFAULT; |
690 | userPtr += 2; | ||
676 | data = le2be16(data); | 691 | data = le2be16(data); |
677 | userCount -= 2; | 692 | userCount -= 2; |
678 | bal += hSpeed; | 693 | bal += hSpeed; |
@@ -690,8 +705,9 @@ static ssize_t ata_ctx_s16le(const u_char *userPtr, size_t userCount, | |||
690 | if (bal < 0) { | 705 | if (bal < 0) { |
691 | if (userCount < 4) | 706 | if (userCount < 4) |
692 | break; | 707 | break; |
693 | if (get_user(data, ((u_int *)userPtr)++)) | 708 | if (get_user(data, (u_int *)userPtr)) |
694 | return -EFAULT; | 709 | return -EFAULT; |
710 | userPtr += 4; | ||
695 | data = le2be16dbl(data); | 711 | data = le2be16dbl(data); |
696 | userCount -= 4; | 712 | userCount -= 4; |
697 | bal += hSpeed; | 713 | bal += hSpeed; |
@@ -727,8 +743,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount, | |||
727 | if (bal < 0) { | 743 | if (bal < 0) { |
728 | if (userCount < 2) | 744 | if (userCount < 2) |
729 | break; | 745 | break; |
730 | if (get_user(data, ((u_short *)userPtr)++)) | 746 | if (get_user(data, (u_short *)userPtr)) |
731 | return -EFAULT; | 747 | return -EFAULT; |
748 | userPtr += 2; | ||
732 | data = le2be16(data) ^ 0x8000; | 749 | data = le2be16(data) ^ 0x8000; |
733 | userCount -= 2; | 750 | userCount -= 2; |
734 | bal += hSpeed; | 751 | bal += hSpeed; |
@@ -746,8 +763,9 @@ static ssize_t ata_ctx_u16le(const u_char *userPtr, size_t userCount, | |||
746 | if (bal < 0) { | 763 | if (bal < 0) { |
747 | if (userCount < 4) | 764 | if (userCount < 4) |
748 | break; | 765 | break; |
749 | if (get_user(data, ((u_int *)userPtr)++)) | 766 | if (get_user(data, (u_int *)userPtr)) |
750 | return -EFAULT; | 767 | return -EFAULT; |
768 | userPtr += 4; | ||
751 | data = le2be16dbl(data) ^ 0x80008000; | 769 | data = le2be16dbl(data) ^ 0x80008000; |
752 | userCount -= 4; | 770 | userCount -= 4; |
753 | bal += hSpeed; | 771 | bal += hSpeed; |