alpine 3.9
obsolete weakness #545

1

Weakness Breakdown


Definition:

An obsolete weakness occurs when someone uses deprecated or obsolete functions when building a system. As a programming language evolves, some functions occasionally become obsolete.

Warning code(s):

This C routine is considered obsolete.

File Name:

cdparanoia/src/cdparanoia-III-10.2/interface/scsi_interface.c

Context:

The highlighted line of code below is the trigger point of this particular Alpine 3.9 obsolete weakness.

 
  handle_scsi_cmd(d, cmd, 6, 0, 56, 0,0, sense);

  key = d->private->sg_buffer[2] & 0xf;
  ASC = d->private->sg_buffer[12];
  ASCQ = d->private->sg_buffer[13];
  
  if(key == 2 && ASC == 4 && ASCQ == 1) return 0;
  return 1;
}

static void reset_scsi(cdrom_drive *d){
  int arg,tries=0;
  d->enable_cdda(d,0);

  cdmessage(d,"sending SG SCSI reset... ");
  if(ioctl(d->cdda_fd,SG_SCSI_RESET,&arg))
    cdmessage(d,"FAILED: EBUSY\n");
  else
    cdmessage(d,"OK\n");

  while(1) {
    if(test_unit_ready(d))break;
    tries++;
    usleep(10);
  }
  
  d->enable_cdda(d,1);
}

static int mode_sense_atapi(cdrom_drive *d,int size,int page){ 
  unsigned char sense[SG_MAX_SENSE];
  unsigned char cmd[10]= {0x5A,   /* MODE_SENSE */
			  0x00, /* reserved */
			  0x00, /* page */
			  0,    /* reserved */
			  0,    /* reserved */
			  0,    /* reserved */
			  0,    /* reserved */
			  0,    /* MSB (0) */
			  0,    /* sizeof(modesense - SG_OFF) */
			  0};   /* reserved */ 

  cmd[1]=d->lun<<5;
  cmd[2]=0x3F&page;
  cmd[8]=size+4;

  if (handle_scsi_cmd (d, cmd, 10, 0, size+4,'\377',1,sense)) return(1);

  { 

The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive licensee of Linus Torvalds, owner of the mark on a world­wide basis.