Skip to content

Commit

Permalink
Merge branch 'main' into fix/value_validation
Browse files Browse the repository at this point in the history
Signed-off-by: Nguyen Dinh Phi <[email protected]>
  • Loading branch information
ita93 committed Jun 4, 2023
2 parents def20c9 + eac7ec4 commit 9db1c32
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 17 deletions.
8 changes: 7 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,11 @@ updates:
- package-ecosystem: gitsubmodule
directory: "/"
schedule:
interval: monthly
interval: weekly
open-pull-requests-limit: 1
- package-ecosystem: cargo
directory: "/"
schedule:
interval: weekly
open-pull-requests-limit: 10
rebase-strategy: "disabled"
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# [Upcoming Release]
# [v0.9.0]

## Fixed
- [[#71]](https://github.com/rust-vmm/linux-loader/issues/71) Fix incorrect
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "linux-loader"
version = "0.8.1"
version = "0.9.0"
authors = [
"The rust-vmm maintainers",
"rust-vmm AWS maintainers <[email protected]>",
Expand All @@ -22,11 +22,11 @@ elf = []
pe = []

[dependencies]
vm-memory = "0.10.0"
vm-memory = "0.11.0"

[dev-dependencies]
criterion = "0.3.5"
vm-memory = { version = "0.10.0", features = ["backend-mmap"] }
vm-memory = { version = "0.11.0", features = ["backend-mmap"] }

[[bench]]
name = "main"
Expand Down
2 changes: 1 addition & 1 deletion rust-vmm-ci
10 changes: 6 additions & 4 deletions src/cmdline/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ fn valid_str(s: &str) -> Result<()> {
}

fn is_quoted(s: &str) -> bool {
if let Some(first_char) = s.chars().next() {
if let Some(last_char) = s.chars().last() {
return first_char == '"' && last_char == '"';
}
if s.matches("\"").count() != 2 {
return false;
}
if let (Some(first_char), Some(last_char)) = (s.chars().next(), s.chars().last()) {
return first_char == '"' && last_char == '"';
}
false
}
Expand Down Expand Up @@ -591,6 +592,7 @@ mod tests {
let mut cl = Cmdline::new(100).unwrap();
assert_eq!(cl.insert("a ", "b"), Err(Error::HasSpace));
assert_eq!(cl.insert("a", "b "), Err(Error::NoQuoteSpace));
assert_eq!(cl.insert("a", "\" bbb\" asd \""), Err(Error::NoQuoteSpace));
assert_eq!(cl.insert("a ", "b "), Err(Error::HasSpace));
assert_eq!(cl.insert(" a", "b"), Err(Error::HasSpace));
assert_eq!(cl.as_cstring().unwrap().as_bytes_with_nul(), b"\0");
Expand Down
9 changes: 2 additions & 7 deletions src/loader/x86_64/elf/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl fmt::Display for Error {

impl std::error::Error for Error {}

#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[derive(Clone, Default, Copy, Debug, PartialEq, Eq)]
/// Availability of PVH entry point in the kernel, which allows the VMM
/// to use the PVH boot protocol to start guests.
pub enum PvhBootCapability {
Expand All @@ -113,15 +113,10 @@ pub enum PvhBootCapability {
/// PVH entry point is not present
PvhEntryNotPresent,
/// PVH entry point is ignored, even if available
#[default]
PvhEntryIgnored,
}

impl Default for PvhBootCapability {
fn default() -> Self {
PvhBootCapability::PvhEntryIgnored
}
}

impl fmt::Display for PvhBootCapability {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
use self::PvhBootCapability::*;
Expand Down

0 comments on commit 9db1c32

Please sign in to comment.