Skip to content
Snippets Groups Projects
Commit ce06694d authored by samm2's avatar samm2
Browse files

use malloc() to ensure that read buffer lands on a single page.

This avoids some bugs seen on LSI controler under FreeBSD.



git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@2904 4ea69e1a-61f1-4043-bf83-b5c94c648137
parent 6664915d
No related branches found
No related tags found
No related merge requests found
......@@ -43,6 +43,10 @@ NOTES FOR FUTURE RELEASES: see TODO file.
<DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
[AS] Use malloc() to ensure that the read buffer lands on a single
page. This avoids some bugs seen on LSI controlers under
FreeBSD.
[CF] Add missing help text for '-d usb*' options.
[CF] Linux: Dereference '/dev/disk/by-*/*' symlink before device type
......
......@@ -48,6 +48,7 @@
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include "config.h"
......@@ -432,11 +433,16 @@ bool sat_device::ata_pass_through(const ata_cmd_in & in, ata_cmd_out & out)
static bool has_sat_pass_through(ata_device * dev, bool packet_interface = false)
{
/* Note: malloc() ensures the read buffer lands on a single
page. This avoids some bugs seen on LSI controlers under
FreeBSD */
char *data = (char *)malloc(512);
ata_cmd_in in;
in.in_regs.command = (packet_interface ? ATA_IDENTIFY_PACKET_DEVICE : ATA_IDENTIFY_DEVICE);
char data[512];
in.set_data_in(data, 1);
return dev->ata_pass_through(in);
bool ret = dev->ata_pass_through(in);
free(data);
return ret;
}
/////////////////////////////////////////////////////////////////////////////
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment