Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 20 Dec 1998 17:23:50 +0100 (CET)
From:      voland@plab.ku.dk
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   kern/9144: acd driver inconsistency (byte order in CDIOCREADAUDIO)
Message-ID:  <199812201623.RAA16517@eagle.plab.ku.dk>

next in thread | raw e-mail | index | archive | help

>Number:         9144
>Category:       kern
>Synopsis:       acd driver inconsistency (byte order in CDIOCREADAUDIO)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Dec 20 08:30:00 PST 1998
>Last-Modified:
>Originator:     Vadim Belman
>Organization:
The Protein Laboratory, University of Copenhagen
>Release:        FreeBSD 2.2.8-RELEASE i386
>Environment:

>Description:

	There is an inconsistency in acd driver behaviour. As written
in cdio.h LBA address format uses network byte order to store the
frame number. But CDIOCREADAUDIO ioctl uses host byte order instead.

>How-To-Repeat:

#include <sys/cdio.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>

/* Commenting out the following line avoids the error. */
#define NETWORK_ORDER

int
main()
{
    char buf[ 2352];
    struct ioc_read_audio ira;
    int h = open( "/dev/wcd0a", O_RDONLY);
    int rc;

    ira.address_format = CD_LBA_FORMAT;
#ifdef NETWORK_ORDER
    ira.address.lba = htonl( 1);
#else
    ira.address.lba = 1;
#endif
    ira.nframes = 1;
    ira.buffer = buf;
    rc = ioctl( h, CDIOCREADAUDIO, &ira);
    if ( rc == -1) {
	perror( "CDIOCREADAUDIO");
    }
    else {
	printf( "Ok.\n");
    }

    close( h);

    return 0;
}

>Fix:
	
--- atapi-cd.c.orig     Sun Dec 20 16:53:43 1998
+++ atapi-cd.c  Sun Dec 20 16:54:13 1998
@@ -931,7 +931,7 @@
                return EINVAL;
 
            if (args->address_format == CD_LBA_FORMAT)
-               lba = args->address.lba;
+               lba = ntohl(args->address.lba);
            else if (args->address_format == CD_MSF_FORMAT)
                lba = msf2lba(args->address.msf.minute,
                             args->address.msf.second,

>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812201623.RAA16517>