centos 7
obsolete weakness #297

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:

gpm-1.20.7/src/synaptics.c

Context:

The highlighted line of code below is the trigger point of this particular Centos 7 obsolete weakness.

  * Disable data reporting (streaming), and flush eventual old packets. As the
 * kernel keeps a queue of received data from the touchpad, the next byte we
 * read could be old data and not the ack to our command or request.  Disable
 * data should always be called before sending commands or request to the
 * touchpad.
 *
 * Note that this is a general ps2 command which should not be in this file,
 * but in mice.c.
 */
static void tp_ps2_disable_data (int fd) 
{
  struct timeval tv;
  fd_set rfds;
  unsigned char status;
  byte cmd = PS2_DISABLE_DATA;

  
  FD_ZERO(&rfds);
  FD_SET (fd, &rfds);
  tv.tv_sec = 0;
  tv.tv_usec = 0;

  write(fd,&cmd,1);

  usleep (50000);
  
  while (select (fd+1, &rfds, NULL, NULL, &tv) == 1) {
    read (fd, &status, 1);
#if DEBUG_RESET
    gpm_report (GPM_PR_INFO,"PS/2 device disable data flush: %02X", status);
#endif
    FD_ZERO(&rfds);
    FD_SET (fd, &rfds);
    tv.tv_sec = 0;
    tv.tv_usec = 0;
  }

  if (status != PS2_ACK)
    gpm_report (GPM_PR_ERR,"Invalid ACK to disable stream command, got %02X",status);
}


/* 
 * syn_ps2_enable_data
 *
 * Enable data after a disable data command. Should have called the disable data
 * before calling this function.
 */

static void syn_ps2_enable_data(int fd) 

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.