Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: base/sys_info_win.cc

Issue 1022863002: Fix uninitialized read in base::SysInfo::HasSeekPenalty(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/sys_info.h" 5 #include "base/sys_info.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <winioctl.h> 8 #include <winioctl.h>
9 9
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (win::GetVersion() < win::VERSION_WIN7) 75 if (win::GetVersion() < win::VERSION_WIN7)
76 return false; 76 return false;
77 77
78 std::vector<FilePath::StringType> components; 78 std::vector<FilePath::StringType> components;
79 path.GetComponents(&components); 79 path.GetComponents(&components);
80 80
81 File drive(FilePath(L"\\\\.\\" + components[0]), File::FLAG_OPEN); 81 File drive(FilePath(L"\\\\.\\" + components[0]), File::FLAG_OPEN);
82 if (!drive.IsValid()) 82 if (!drive.IsValid())
83 return false; 83 return false;
84 84
85 STORAGE_PROPERTY_QUERY query; 85 STORAGE_PROPERTY_QUERY query;
rvargas (doing something else) 2015/03/19 19:14:41 maybe = {} here instead? (it's kind of lame to hav
Dan Beam 2015/03/19 20:52:38 Done.
86 query.QueryType = PropertyStandardQuery; 86 query.QueryType = PropertyStandardQuery;
87 query.PropertyId = StorageDeviceSeekPenaltyProperty; 87 query.PropertyId = StorageDeviceSeekPenaltyProperty;
88 query.AdditionalParameters = {};
88 89
89 DEVICE_SEEK_PENALTY_DESCRIPTOR result; 90 DEVICE_SEEK_PENALTY_DESCRIPTOR result;
90 DWORD bytes_returned; 91 DWORD bytes_returned;
91 92
92 BOOL success = DeviceIoControl(drive.GetPlatformFile(), 93 BOOL success = DeviceIoControl(drive.GetPlatformFile(),
93 IOCTL_STORAGE_QUERY_PROPERTY, 94 IOCTL_STORAGE_QUERY_PROPERTY,
94 &query, sizeof(query), 95 &query, sizeof(query),
95 &result, sizeof(result), 96 &result, sizeof(result),
96 &bytes_returned, 97 &bytes_returned,
97 NULL); 98 NULL);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 void SysInfo::OperatingSystemVersionNumbers(int32* major_version, 157 void SysInfo::OperatingSystemVersionNumbers(int32* major_version,
157 int32* minor_version, 158 int32* minor_version,
158 int32* bugfix_version) { 159 int32* bugfix_version) {
159 win::OSInfo* os_info = win::OSInfo::GetInstance(); 160 win::OSInfo* os_info = win::OSInfo::GetInstance();
160 *major_version = os_info->version_number().major; 161 *major_version = os_info->version_number().major;
161 *minor_version = os_info->version_number().minor; 162 *minor_version = os_info->version_number().minor;
162 *bugfix_version = 0; 163 *bugfix_version = 0;
163 } 164 }
164 165
165 } // namespace base 166 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698